XML API for Sending BULK Numbers

Our function which sends bulk Numbers.

Once this function is run, it will send 1000 SMS at a time. 

We call this function in a loop(which loops for 10 times) that is in a program, 10000 SMS should be sent.

function send_subcampaign(){

 global $uid,$cmpid,$numbers,$scmpid,$scheduledatetime;

 global $user,$password,$api_id;

global $db_host,$db_name,$db_user,$db_password; //include global variables

 //get message



 echo "message: ".$text."<br />\r\n";

$numbersarray=explode(",",$numbers); //stores numbers as array

$message_ids=array(); //stores message ids

 /*XML API by Aditya*/

$numbers_xml_string=""; //stores XML string of numbers and message

 foreach($numbersarray as $mob){



 //XML string to be encoded


 $xmlstring=urlencode($xmlstring);//encode the string

 //prepare URL


 // create a new cURL resource

 $ch = curl_init();

 //set URL and other appropriate options

 curl_setopt($ch, CURLOPT_URL,$url);

 curl_setopt($ch, CURLOPT_HEADER, 0);  

 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  

 // grab URL and pass it to the browser


 // close cURL resource, and free up system resources



 //explode response as an array to insert into database

$responsearray=explode("Thread",$response); //response will contain message ids separated by space (' ')

$xml =new SimpleXMLElement($responsearray[0]);


 foreach ($xml->children() as $MessageIds){


 //echo "Message Id: ".$message_ids[$count]."<br />\r\n";




 //connect to the database


 foreach($message_ids as $msgid){

 $result = mysqli_query($con,"insert into smsmessagereport(cmpid,uid,messageid) values(".$cmpid.",".$uid.",'".$msgid."')");


 //close connection


 /*End XML API by Aditya*/


For API Please signup at : www.smsgatewayhub.com

Please note that some of the above code has been supplied to SMSGATEWAYHUB by clients. As such, accuracy is not guaranteed by SMSGATEWAYHUB.