I have a api which sends messages to the people ,and the api in the form of url ,which takes user login details and the phone number as input for the url .At a time a time I am able to send 10 sms ,but I want to implement it for bulk sms .
I am trying this code ,but it's working only for 10sms,if we are providing more than 10 mobile numbers it's not working ,can anyone suggest me what mistake I making in my code
Code:
$numbersarray=explode(",",$numbers); //stores numbers as array
/*XML API by Aditya*/
$numbers_xml_string=""; //stores XML string of numbers and message
foreach($numbersarray as $num){
$numbers_xml_string.="<Message><To>".$num."</To><Text>".$text."</Text></Message>";
}
//XML string to be encoded
$xmlstring="<SmsQueue><Account><User>".$user."</User><Password>".$password."</Password></Account><MessageData><SenderId>".$api_id."</SenderId><Gwid>1</Gwid><DataCoding>0</DataCoding></MessageData><Messages>".$numbers_xml_string."</Messages></SmsQueue>";
$xmlstring=urlencode($xmlstring);//encode the string
//prepare URL
$url="http://login.smsgatewayhub.com/xmlapi/pushsms.aspx?data=".$xmlstring;
echo "url".$url;
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($numbersarray),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);