I am currently looping through an array of numbers in PHP and sending an API request to send a message to those numbers. It works perfectly, except I am expecting the array to eventually get to over 1000 numbers and the API has a 1 call per second limit, which means it will take over 15 minutes to deliver the calls. I was told by the vendor (Telnyx) that I could make an async function that would send multiple requests at once. I searched for a solution but most of them involved server modifications, etc. Any ideas would be appreciated. Here is my loop:
$sql = "SELECT userphone from $table_name WHERE list='$received_list'";
$result = mysqli_query($con,$sql);
if($countrows = mysqli_num_rows($result) >= 1){
while ($row = mysqli_fetch_array($result)){
$propernum="+1".$row['userphone'];
\Telnyx\Message::Create([
"messaging_profile_id" => $profile, // Your Telnyx numbe// Your Telnyx number
"to" => $propernum,
"text" => $sendmessage
]);
$jsent=$jsent+1;
}
exit;
}