PHP SDK

Send messages from PHP Apps and Websites

Using the IntelliSMS PHP SMS SDK you can send SMS messages from your PHP scripts. This PHP SMS Library is free to download, use and distribute.

Properties:

AccessKey This is your AccessKey used to authenticate to you IntelliSoftware account
Click here to create an AccessKey / SecretKey pair
SecretKey This is your SecretKey used to authenticate to you IntelliSoftware account
Click here to create an AccessKey / SecretKey pair
MaxConCatMsgs Maximum number of concatenated SMS messages that will be sent per recipient (Default is 1)

SendMessage Method

Sends an SMS message via the Internet Gateway.

SendMessage ( $to, $text, $from )

Parameters:

$to Input This is the destination phone number
$text Input The content of the text message
$from Input This is the source/sender's phone number
SendStatusArray Return

Array containing the send status for each recipient. See SendStatusArray

PHP Sample:

<?php

include 'IntelliSMS.php';

//Required php.ini settings:
// allow_url_fopen = On
// track_errors = On

$objIntelliSMS = new IntelliSMS();

$objIntelliSMS->AccessKey = "Yva$ER%Uhs+UU[MzwEYe";
$objIntelliSMS->SecretKey = "F{kQ^s`wVpm!EU~Bx8yB^A$N$[l{pxJA";

$objIntelliSMS->SendMessage ( '44771012345,44771023456', 'Hello', 'SENDER_ID' );

?>

SendUnicode Message Method

Sends a Unicode SMS message to multiple recipients via the Internet Gateway. The Unicode format is used to send multilingual messages not support by the standard GSM character set.

SendUnicodeMessage ( $to, $text, $from )

See Unicode Character Codes for more details.

Parameters:

$to Input This is the destination phone number
$text Input The content of the text message
$from Input This is the source/sender's phone number
SendStatusArray Return

Array containing the send status for each recipient. See SendStatusArray

PHP Sample:

<?php

include 'IntelliSMS.php';

//Required php.ini settings:
// allow_url_fopen = On
// track_errors = On

$objIntelliSMS = new IntelliSMS();

$objIntelliSMS->AccessKey = "Yva$ER%Uhs+UU[MzwEYe";
$objIntelliSMS->SecretKey = "F{kQ^s`wVpm!EU~Bx8yB^A$N$[l{pxJA";

$objIntelliSMS->SendUnicodeMessage ( '44771012345,44771023456', 'Message with Unicode Characters', 'SENDER_ID' );

?>

SendBinary Message Method

Sends a Binary SMS message via the Internet Gateway. Binary Messages can be used to send SmartMessages, such as Ringtones and Logos.

SendBinaryMessage ( $to, $userdataheaderhex, $userdatahex, $from )

Parameters:

$to Input This is the destination phone number
$userdataheaderhex Input (Optional) User Data Header
$userdatahex Input User Data (140 octets max)
$from Input This is the source/sender's phone number
SendStatusArray Return

Array containing the send status for each recipient. See SendStatusArray

PHP Sample:

<?php

include 'IntelliSMS.php';

//Required php.ini settings:
// allow_url_fopen = On
// track_errors = On

$objIntelliSMS = new IntelliSMS();

$objIntelliSMS->AccessKey = "Yva$ER%Uhs+UU[MzwEYe";
$objIntelliSMS->SecretKey = "F{kQ^s`wVpm!EU~Bx8yB^A$N$[l{pxJA";

$objIntelliSMS->SendBinaryMessage ( "44771012345,44771023456", 
    "06050415820000", 
    "32F40100480E0100000000000000000000000000000000000000" .
    "0000000000000000000001247803000000E0080120CC06400000" .
    "40080120CC06C00000479E7124F0EFFADCF64448892479B6DAC6" .
    "CD4448F9241DB6DACECF44488124CDB6CD96CC44488924CDB6CD" .
    "96CDE446712478E66D9EC6000000000000000000000000000000" .
    "000000", "SENDER_ID" );

?>

SendWapPush Message Method

Sends a WAP PUSH message via the Internet Gateway. WAP PUSH messages can send multimedia content, such as an Image, Wallpaper, Ringtone or a link to WAP website.

SendWapPushMessage ( $to, $text, $href, $from )

Parameters:

$to Input This is the destination phone number
$text Input Display Text for WAP PUSH message
$href Input URL link to resource ( should start with 'http://' or 'https://' )
$from Input This is the source/sender's phone number
SendStatusArray Return

Array containing the send status for each recipient. See SendStatusArray

PHP Sample:

<?php

include 'IntelliSMS.php';

//Required php.ini settings:
// allow_url_fopen = On
// track_errors = On

$objIntelliSMS = new IntelliSMS();

$objIntelliSMS->AccessKey = "Yva$ER%Uhs+UU[MzwEYe";
$objIntelliSMS->SecretKey = "F{kQ^s`wVpm!EU~Bx8yB^A$N$[l{pxJA";

$objIntelliSMS->SendWapPushMessage ( '44771012345', 
    'The message text', 
    'http://www.intellisoftware.co.uk/images/IntelliSMS.gif', 
    'SENDER_ID' );

?>

Considerations:

Our gateway will only send one SMS message per submission. Therefore a WAP PUSH message is charged at 1 credit.

An INVALID_REQUEST will result if the submitted text and href parameters would require 2 SMS messages to be sent. As a guide, the href and text parameters combined should not exceed 114 characters (assuming href starts with 'http://www.' )

GetBalance Method

Obtains the available credits on an account.

GetBalance()

Parameters:

$results["Balance"] Return (Array) Number of remaining credits
$results["ErrorStatus"] Return (Array)

See ResultCodes

PHP Sample:

<?php

include 'IntelliSMS.php';

//Required php.ini settings:
// allow_url_fopen = On
// track_errors = On

$objIntelliSMS = new IntelliSMS();

$objIntelliSMS->AccessKey = "Yva$ER%Uhs+UU[MzwEYe";
$objIntelliSMS->SecretKey = "F{kQ^s`wVpm!EU~Bx8yB^A$N$[l{pxJA";

$Results = $objIntelliSMS->GetBalance();

$ErrorStatus = $Results["ErrorStatus"];
$Balance = $Results["Balance"];

?>

SendStatusArray

Array containing the send status for each recipient.

Array Entries:

$SendStatus["To"] Recipient this entry relates to
$SendStatus["MessageId"] Unique message ID for this submission
$SendStatus["Result"] Send status (See ResultCodes)

PHP Sample:

<?php

include 'IntelliSMS.php';

//Required php.ini settings:
// allow_url_fopen = On
// track_errors = On

$objIntelliSMS = new IntelliSMS();

$objIntelliSMS->AccessKey = "Yva$ER%Uhs+UU[MzwEYe";
$objIntelliSMS->SecretKey = "F{kQ^s`wVpm!EU~Bx8yB^A$N$[l{pxJA";

$SendStatusCollection = $objIntelliSMS->SendMessage ( '44771012345', 'Hello', 'SENDER_ID' );

$sendresult_detailed = "";
foreach ( $SendStatusCollection as $SendStatus )
{
	$sendresult_detailed = $sendresult_detailed . 
	                       $SendStatus["To"] . "  " . 
	                       $SendStatus["MessageId"] . "  " . 
	                       $SendStatus["Result"] . "<BR>";
}

echo $sendresult_detailed;

?>
    		

Result Codes

A text string that indicates the success/failure of a request.

Values:

OK Request was successfully actioned
AUTH_PARAMETER_MISSING Parameter(s) required authenitcation are missing
AUTH_PARAMETER_INVALID Parameter(s) required authenitcation are invalid
NO_TO Message recipient(s) not specified
NO_TEXT Message text not specified
NO_TEXT Message text not specified
NO_MSGID MsgId parameter was missing
TOO_MANY_NUMBERS Too many recipient number were specified
INSUFFICIENT_CREDIT Insufficient credit available to complete the request
GATEWAY_ERROR An error occurred on remote gateway (please retry later)
INTERNAL_ERROR An error occurred on remote gateway (please retry later)
INVALID_NUMBER The recipient number is invalid
INVALID_REQUEST The request was invalid
MSGID_INVALID Supplied Message ID not valid
PARAMETER_MISSING Mandatory parameter is missing
PARAMETER_INVALID A supplied parameter is invalid
DAILY_ALLOWANCE_EXCEEDED The configured daily allowance on the AccessKey has been exceeded
MONTHLY_ALLOWANCE_EXCEEDED The configured monthly allowance on the AccessKey has been exceeded
CONNECTION_NOT_SECURE Connection refused as the connection is not secure
ACCOUNT_EXISTS CreateSubaccount - subaccount already exists

Advanced Features

Send to Distribution Lists (or Group Send)

Our gateway allows you to send SMS messages to preconfigured Distribution Lists or Groups. To send to a Distribution List or Group simply insert the Group Name were you would normally place the recipient's phone number. Distribution Lists or Groups are setup in your online account login on the Contacts page.

Reply Tracking:

The IntelliSoftware platform provides tracking of SMS replies, allowing you to determine which particular message a mobile user is replying to. When you submit a message to the SMS Gateway you can supply a User Context parameter. When a reply is received, the IntelliSoftware platform will included the User Context parameter when forwarding the message to your server.

The User Context can be supplied to the IntelliSoftware platform in the following ways:

.Net Component use SendMsgWithUserContext method
COM Component use SendMessageWithUserContext method
HTTP Interface add 'usercontext' POST/GET parameter
SMTP Interface (Email to SMS) add 'UserContext:' parameter
PHP SDK use SendMessageWithUserContext method
Java SDK use SendMessageWithUserContext method

The IntelliSoftware platform will forward the User Context for received messages in the following ways:

HTTP Interface 'usercontext' POST/GET parameter
SMTP Interface (SMS to Email) User Context appears in Subject line

Secure SSL Connection (HTTPS):

To use a secure internet connection configure the gateway addresses as follows:

<?php
    $objIntelliSMS->PrimaryGateway="https://www.intellisoftware.co.uk";
    $objIntelliSMS->BackupGateway="https://www.intellisoftware2.co.uk";

    $objIntelliSMS->SendMessage ( ......
?>

NOTE: To use https you will need the OpenSSL extension module