Send SMS from PHP Script (Updated)

Posted by on Jan 25, 2011 in Support Blog

Topic Keywords: ,

Quite a few people use the PHP script that Bryce provided 7-1/2 years ago for sending an SMS message through NowSMS from PHP.

Over the years, we’ve added a few comments to clarify how the script is to be used.  However, one of the most limiting things about the script is that it doesn’t support any of the additional SMS URL parameters supported by NowSMS.

Among other uses, these parameters might be needed in order to specify the SMSC Route to be used for sending the message, or specifying a sender address.

An updated SendSMS.php script, which supports additional URL parameters is available at http://www.nowsms.com/download/sendsms2-php.txt.

In the original script, we provided the following example for calling the SendSMS PHP function:

$x   = SendSMS("127.0.0.1", 8800, "username", "password", "+44999999999",

 "Test Message");

 
The new script supports the above format, but can also support additional optional parameters, specified in “parameter=value” format.  For example, the following example specifies an explicit outbound SMSC route to be used.

$x   = SendSMS("127.0.0.1", 8800, "username", "password", "+44999999999",

 "Test Message", "SMSCRoute=Test");

 
The following example specifies an explicit outbound SMSC route and a sender address to be used.

$x   = SendSMS("127.0.0.1", 8800, "username", "password", "+44999999999",

 "Test Message", "SMSCRoute=Test", "Sender=1234");

 
For additional usage information regarding this PHP script, please refer to the original discussion of sendsms.php at http://www.nowsms.com/nowsms-php-example-send-sms-text-message.

For more information about NowSMS URL parameters, see http://www.nowsms.com/doc/submitting-sms-messages/url-parameters.

The updated SendSMS.php script is available at http://www.nowsms.com/download/sendsms2-php.txt.

For comments and further discussion, please click here to visit the NowSMS Technical Forums (Discussion Board)...

2 Responses to “Send SMS from PHP Script (Updated)”

  1. will trial version allow bulk sms through php script