Bulk SMS API For Developers

The API FOR sending BULK SMS is as shown below:

PARAMETERS

API Type – (REST)

  1. MSISDN

2. Text_Message

3. Passwrd

4. Text_ID

5. Username


The password for your API eg x1234 USAGE http://privateip:port/sms/?username=test&msisdn=254721xxxxxx&text_message=New%20A PI%20test&passwd=x1234&text_id=1001 port: xxxx XML Response Sample Success response   <ReturnValue xmlns=”http://schemas.datacontract.org/2004/07/ ” xmlns:i=”ht tp://www.w3.org/2001/XMLSchema-instance”> <error/> <result>254721xxxxxx at 6:31:10 PM</result> <sms>testing New apI Test</sms> <success>true</success> </ReturnValue>   Other Responses OK | 1 FAIL | 0 Delivery Queries To query for Delivery Status use the text_id parameter http://privateip:8020/status_bulk/? username=test& passwd=x1234&text_id=1001 Note 1. You cannot use the same text_id for more than 1 SMS since the text_id is unique 2. URL-Encode the content in text_message , to avoid misinterpretation of the text


 

 

#parameters

$msg_type = $_GET[‘msg_type’];

#PI%23ghtr&passwd=12345&text_id=1

$username = $_GET[‘username’];

$msisdn = $_GET[‘msisdn’];

$text_message = $_GET[‘text_message’];

$passwd = $_GET[‘passwd’];

$text_id = $_GET[‘text_id’];
#Code Below

function sendBulk($msisdn,$text_message,$username,$msg_type,$passwd,$text_id){

$msisdn_val = urlencode($msisdn);

$text_msg_val = urlencode($text_message);

$username_val = urlencode($username);

$passwd_val = urlencode($passwd);

$str= “?msisdn=”.$msisdn_val.”&text_message=”.$text_msg_val.”&username=”.$username_val.”&passwd=”.$passwd_val.”&text_id=”.$text_id.”&msg_type=”.$msg_type;

$ch=curl_init();

curl_setopt($ch,CURLOPT_URL,’http://xx.xxx.xxx.xxx/www/api/’.$str);

curl_exec($ch);

curl_close($ch);

# return $results;

}

$errorNo = 0;

if($msg_type==””){

echo “FAIL | Error 1602: Missing message Type”;

$errorNo+=1;

}

if($msisdn==””){

echo “FAIL | Error 1603: Missing msisdn”;

$errorNo+=1;

}

if($text_id==””){

echo “FAIL | Error 1604: Missing Text ID”;

$errorNo+=1;

}

if($text_message==””){

echo “FAIL | Error 1605: Blank message”;

$errorNo+=1;

if ($username==””){

echo “FAIL | Error 3600: Missing username”;

$erroNo=1;

}

if($errorNo==0){

sendBulk($msisdn,$text_message,$username,$msg_type,$passwd,$text_id);

}

?>