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.
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: Use the following PHP code to declare and create the MM4 object:
$objMm4Protocol = new Com("ActiveXperts.MmsProtocolMm4");
Insert the following line to declare and create the MmsMessage object:
$objMessage = new Com("ActiveXperts.MmsMessage");
Insert the following line to declare and create the MmsSlide object:
$objSlide = new Com("ActiveXperts.MmsSlide");
Insert the following line to declare and create the MmsConstants object:
$objConstants = new Com("ActiveXperts.MmsConstants");
To send an MMS using the MM4 module, you'll need an MM4 provider to send the MMS messages. The following information is required by the toolkit to send the MMS to the recipient:
Create a form which collects this information from the user.
If the com objects described in step 2 are being created successfully, you can now send MMS messages using an SMTP connection to an MMSC.
The following PHP code generates a website where the user can fill in a file located on the webserver, and send it as a MMS message to his mobile phone or email address.
The demo can be launched from a client connecting to the PHP webserver. The client does not need any additional hardware. The modem has to be connected to the webserver.
The following PHP code shows how to send a MMS:
//create the objects
$objMm4Protocol = new Com("ActiveXperts.MmsProtocolMm4");
$objMessage = new Com("ActiveXperts.MmsMessage");
$objSlide = new Com("ActiveXperts.MmsSlide");
$objConstants = new Com("ActiveXperts.MmsConstants");
$attachment = "C:\Windows\System32\Setup.bmp";
$numLastError = 0;
$strLastError = "";
$strReply = "";
if( $_POST["CTL_SEND"] != "" ){
$attachment = $_POST["CTL_ATTACHMENT"];
$objSlide->Clear();
$objSlide->AddText( $_POST["CTL_MESSAGE"] );
if( $_POST["CTL_ATTACHMENT"] != "" ) $objSlide->AddAttachment( $_POST["CTL_ATTACHMENT"] , 0 );
$objMessage->Clear();
$objMessage->AddRecipient( $_POST["CTL_RECIPIENT"], $objConstants->asMMS_RECIPIENT_TO );
$objMessage->From = $_POST["CTL_SENDER"];
$objMessage->Subject = $_POST["CTL_SUBJECT"];
$objMessage->AddSlide( $objSlide );
$objMm4Protocol->Clear();
$objMm4Protocol->ProviderHost = $_POST["CTL_HOST"];
$objMm4Protocol->ProviderPort = $_POST["CTL_PORT"];
$objMm4Protocol->ProviderDomain = $_POST["CTL_DOMAIN"];
$objMm4Protocol->ProviderAccount = $_POST["CTL_ACCOUNT"];
$objMm4Protocol->ProviderPassword = $_POST["CTL_PASSWORD"];
$objMm4Protocol->Send( $objMessage );
$numLastError = $objMm4Protocol->LastError;
$strLastError = $objMm4Protocol->GetErrorDescription( $numLastError );
}
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.