The following PHP code shows how to send a SMS message through a SMPP provider:
ActiveXperts SMS and MMS Toolkit PHP Sample
Send an SMS message to a recipient through an SMPP connection.
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();
?>
This demo uses the ActiveXperts SMS and MMS Toolkit, an ActiveXperts Software product.
No comments:
Post a Comment