Wednesday, November 21, 2012

PHP Code – Send SMS

Send SMS – PHP Script

Many of Persons Use Some Websites for sending SMS Like way2sms.com and 160by2.com . Did They Know That How to Send a SMS from a Website. The Reason Behind this is They Require a Gateway or API for Sending SMS to Mobile.
There are Some Websites Which Provides You SMS Sending Service Which is Compatible with Variety of Languages like PHP,Perl,Python etc.
So This Code Help You to Send SMS to Mobile.But You will need to register onTextMagicAccount Which Provides You an API For Using This SMS Sending Service.
To Use This Code Just Copy and Paste It.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Include the TextMagic PHP lib
require('textmagic-sms-api-php/TextMagicAPI.php' );
// Set the username and password information
$username = 'myusername' ;
$password = 'mypassword' ;
// Create a new instance of TM
$router = new TextMagicAPI(array(
'username'  => $username,
'password'  => $password
));
// Send a text message to '999-123-4567'
$result = $router->send('Wake up!' , array(9991234567), true);
// result: Result is: Array ( [messages] => Array
( [19896128] => 9991234567 ) 
[sent_text] => Wake up! [parts_count] => 1 )

No comments:

Post a Comment