2

I am currently using clickatell to send a msg to a single numbers using the FOR method

for($i = 0;$i < count($textrecievers); $i++){
$url = 'http://api.clickatell.com/http/sendmsg?user=user&password=****&api_id=00000&to=1'.$textrecievers[$i].'&text='.$msgtxt.'&mo=1&from='.$_SESSION['routing'];

$ret = file($url);
            }

The problem with this is i cannot report it to the database if one of them fails since i cannot use this method

$send = explode(":",$ret[0]);

                if ($send[0] == "ID") {
echo 'OK';
}

Is there any way to just send it as a bulk text like this:

$to = array('1111111111','2222222222','3333333333')

and then put it in the usr as such

 $url = 'http://api.clickatell.com/http/sendmsg?user=user&password=****&api_id=00000&to='.$to.'&text='.$msgtxt.'&mo=1&from='.$_SESSION['routing'];

so it will send it to all the numbers in the array at 1 go, so i can report it as a success or not.

Link
  • 303
  • 1
  • 5
  • 13

2 Answers2

3

Not sure if I understand your question correctly, but you can comma separate mobile numbers like this:

http://api.clickatell.com/http/sendmsg?api_id=....&to=123456789,123456789,123456789,123456789,123456789,123456789&text=....

You can comma separate about 300 numbers with an HTTP GET to be safe (and much more with a POST such as 800 - depending on how long you wait to timeout).

// Comma separate and add leading 1 for country code $comma_separated = implode(",1", $YourArray);

You will receive a tracking message ID for each message (or an error), so you can keep track if any specific number was rejected.

Does this answer your question?

whatever_sa
  • 540
  • 3
  • 7
0

Unfortunately, you can no longer send to multiple numbers using the http API in one call (you could loop through the numbers call the API multiple times though)

You can send a message to a single handset in one single HTTPS request.

Another option is to use the REST API to send to multiple numbers (max 200 per call according to their documentation): https://www.clickatell.com/developers/api-documentation/rest-api-send-message/

TimoSolo
  • 7,068
  • 5
  • 34
  • 50