I am developing an application that sends different messages to different recipients.The phone numbers and messages are stored in a table,and i use the curl function in a loop to call the API url.The issue is that after the first 10 (or so numbers),the maximum execution time parameter is exceeded,and not all numbers are sent.The support staff of the gateway company said i should try queuing the messages so that i could send them in bulk instead of looping.From the API i know that i can send messages to multiple recipients by separating each number with a comma,so i figure that issue is handled if i implode the array containing the phone numbers.The issue is how to handle the messages in the message array to deliver different messages to different numbers.Or rather,how do i que the numbers and messages so that everything is delivered in bulk to the API?. Below is an excerpt from my code:
Code:
while($launch_row=mysqli_fetch_assoc($launch_result)) { $number=$launch_row['phone_number']; $message=$launch_row['message']; $url="http://xxxxxxxxxxx?username=yy&password=yyy&type=0&dlr=1&destination=".urlencode($number)."&source=xxx&message=".urlencode($message); $ch = curl_init(); _setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); $results = curl_exec($ch); }
Comment