You are here:
ActiveXperts.com > SMS and MMS Toolkit > How to Use the SMS and MMS Toolkit > SMPP Provider > PHP
Quicklinks
The SMS and MMS Toolkit is a software development kit (SDK) to enhance an application or script with SMS, MMS and Pager functionality. SMS messages can be sent using a GSM/GPRS modem, an SMPP provider, an HTTP compliant SMS provider or using a standard dialup or fixed-line SMS modem. MMS messages can be sent via a GSM/GPRS modem (MM1), an SMTP server (MM4) or an XML/SOAP compliant provider (MM7).
SMS features:
MMS features:
Pager features:
This document describes how the SMS and MMS Toolkit can be integrated into PHP projects.
On each client PC, download the SMS and MMS Toolkit from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.
You must use the following code to declare the COM object(s) in PHP:
Insert the following line to declare and create the Smpp object:
$objSmppProtocol = new COM ( "ActiveXperts.SmsProtocolSmpp" );
Insert the following line to declare and create the SmsConstants object:
$objSmsMessage = new COM ( "ActiveXperts.SmsMessage" );
Insert the following line to declare and create the SmsConstants object:
$objSmsConstants = new COM ( "ActiveXperts.SmsConstants" );
You can now send and/or receive SMS messages.
The following PHP code shows how to send a SMS message through a SMPP provider:
<html>
<head>
<META HTTP-EQUIV="CONTENT-Type" CONTENT="text/html;CHARSET=utf-8" >
<title>ActiveXperts SMS and MMS Toolkit PHP Sample</title>
</head>
<body>
<font face="sans-serif" size="2">
<hr size="1" color="#707070">
<font size="4">ActiveXperts SMS and MMS Toolkit PHP Sample</font>
<br>
<br>
<b>Send an SMS message to a recipient through an SMPP connection.</b>
<br>
<br>
<hr size="1" color="#707070">
<br>
<?php
$objSmppProtocol = new COM ( "ActiveXperts.SmsProtocolSmpp" );
$objSmppProtocol->Server = "smpp.activexperts-labs.com";
$objSmppProtocol->ServerPort = 2775;
$objSmppProtocol->SystemID = "ax004";
$objSmppProtocol->SystemPassword = "812056";
$objSmppProtocol->SystemType = "SMPP";
$objSmppProtocol->Logfile = "c:\\PhpSmppLog.txt";
$objSmppProtocol->ServerTimeout = 5000;
$objSmppProtocol->SystemMode = 1;
$objSmsMessage->Recipient = "+31647134225";
$objSmsMessage->Data = "Hello World, SMS Message From PHP";
$objSmsMessage->Format = 0;
$objSmppProtocol->Connect();
if ( $objSmppProtocol->LastError == 0 )
{
$objSmppProtocol->Send( objSmsMessage );
}
if ( $objSmppProtocol->LastError == 0 )
{
Echo "Message successfully submitted.";
}
else
{
$ErrorNum = $objSmppProtocol->LastError;
$ErrorDes = $objSmppProtocol->GetErrorDescription ( $ErrorNum );
Echo "Error sending message: #$ErrorNum ($ErrorDes).";
}
$objSmppProtocol->Disconnect();
?>
<br>
<br>
<hr size="1" color="#707070">
<font size="1" face="Verdana">This demo uses the ActiveXperts SMS and MMS Toolkit, an <a href="http://www.activexperts.com">ActiveXperts Software</a> product.</font>
</body>
</html>
There are many working samples included with the product. You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/mobile-messaging-component.