www.smsroaming.
com
admin@smsroaming.com
SMSRoaming Smart Messaging
System
HTTP Application Programming Interface
www.smsroaming.com
admin@smsroaming.com
0. Introduction
The SMSRoaming system offers various methods of sending and receiving SMS messages.
This document contains specifications for the following methods:
- Send messages using HTTP GET
- Send messages using PHP-HTTP API
- Send messages using PHP API
- Receive messages using PHP API
1. Send Messages Using HTTP GET
An example for a normal text message to a single recipient number:
Normal SMS : http://smsroaming.com/my/api/sms-
http.php?username=xxxx&password=xxxx&code=92&number=03333666252&msg=testing SMS
SMS with Sender ID : http://smsroaming.com/my/api/sms-
http.php?username=xxxx&password=xxxx&code=92&number=03333666252&msg=testing
SMS&sender=Coke
Check Balance : http://smsroaming.com/my/api/sms-
http.php?username=xxxx&password=xxxx&chkbal=1
Notes:
$username="xxxxx"; //Provide your smsroaming username
$password="xxxxx"; //Provide your smsroaming account password
$chkbal="0"; //if you want to just check your balance. send 1
$code="xxx"; //Enter Country Code (For Example 61 for Australia)
$number="xxxxxxxx"; //Enter mobile number without Country Code
$msg="I am testing Api"; //your Message
$msg=rawurlencode($msg); //if you will remove this line...you can't send special characters
like +$%^^& etc
$sender="xxxxx"; //Your Required Sender ID (SMS Masking)
www.smsroaming.com
admin@smsroaming.com
2. Send Messages Using PHP-HTTP API
Download PHP-HTTP API
3. Send Messages Using PHP API
To integrate this API in your website, follow these steps:
Download PHP API
How to Send SMS:
From where you want to send a SMS include API File
require_once('include/smsroamingAPI.php');
Now Call this function
$chk=sendSMS("username","password","code","mobile","Your Message");
Function will return following values which you can use to check status of your message you just sent.
$chk = 1 : Message Sent
$chk=-1: Invalid Username/Password
$chk = -2: Insufficient Balance
$chk = 0: Message Sending Failed
That’s it :). You can also check your balance using:
echo chkBAL("username","password");
If you are a Corporate User you can send your message with Open Sender ID:
For Example:
sendSMS("username","password","code","mobile","Your Message",”Sender ID”);
www.smsroaming.com
admin@smsroaming.com
4. Receive Messages Using PHP API
To integrate this API in your website, follow these steps:
Download PHP API
How to Receive SMS:
Step 1: Include header file require_once('include/smsroamingAPI.php');
Step 2: Call a function to get all sms providing your username and password
i-e $getData = getMsgs("username","password");
Step 3: after this you have to decode data using this function
$data=json_decode($getData);
Step 4: now you can use your messages in any way
lets say you want to print them. than you have to follow this
for($i=0;$i<count($data);$i++)
{
echo "<strong>Message</strong>: ".$data[$i]->msg."<br/>";
echo "<strong>Source</strong>: ".$data[$i]->src."<br/>";
echo "<strong>Date</strong>: ".$data[$i]->date."<br/>";
echo "<strong>Contact Name</strong>: ".$data[$i]->name."<br/>";
echo "<br/><br/>";
}
Step 5: after getting all your messages and after Reading/Storing them you should have to call a
function which will mark these sms as Read so in next call you will not get these messages.
getMsgsDone("username","password");
P.S you can check status of server by:
if($getData==-1)
die("Invalid Username/Password or Unable to connect Server");