sending multiple messages using clickatell gateway

1k Views Asked by At

I used php server side to connect with clickatell messages service , i used the soap api technique to make the connection . it is working .but in my code , i can send just one message at the same time , here is the code :

    function actionSendSMS(){
       $msgModel = new Messages();
      $settModel = new Settings();

       $setRows = $settModel->findAll();
      $usr=$setRows[0]->clickatell_usr;
     $pwdRows = $settModel->findAll();
     $pwd=$pwdRows[0]->clickatell_pwd;


   $api_idRows = $settModel->findAll();

   $api_id=$api_idRows[0]->clickatell_api_id;







    $msgModel->findAllBySql("select * from messages where is_sent=0 and   
    send_date=".date("m/d/Y"));

      $client = new SoapClient("http://api.clickatell.com/soap/webservice.php?WSDL");
      $params = array('api_id' => $api_id,'user'=> $usr,'password'=> $pwd);
      $result = $client->auth($params['api_id'],$params['user'],$params['password']);
      $sessionID = substr($result,3);
      $callback=6;
     // echo $result."<br/>";
     // echo $sessionID;

      $params2 = array('session_id'=>$sessionID, 'api_id' => $api_id,'user'=> 
        $usr,'password'=>$pwd,
      'to'=>array('962xxxxxxx'), 'from'=>"thetester",'text'=>'this is a sample test  
           message','callback'=>$callback);
      $result2 = $client->sendmsg($params2['session_id'],  
           $params['api_id'],$params['user'],$params['password'],
      $params2['to'],$params2['from'],$params2['text'],$params2['callback']);
      print_r( $result2)."<br/>";




    $apimsgid=  substr($result2[0],4);

   $rowsx=Messages::model()->findAllBySql("select * from messages where is_sent=0 and  
     send_date='".date("m/d/Y")."'");



      for($i=0;$i<count($rowsx);$i++)
    {



      $rowsx[$i]->clickatell_id=$apimsgid;

     $rowsx[$i]->save();

       }


        //echo $apimsgid."<br/>";



          if (substr($result2[0], 0,3)==='ERR' && (!(substr($result2[0], 0,2)==='ID'  
          )  ))
      {
          echo 'Connot Routing Message';


      }

.... now you see that this code will send one message at the same time , forget about the id , its for personal purpose , now this service i have to modify it , to send multiple messages at the same time , and i will give every message an unique ID , so now my problem is : is there any one knows if there is a service to send multiple sms at the same time ;

as in my code i fill the information for one message ,but i need a service to send multiple sms , does any body can give me a link to this service , i made many searches but there is no answer i have found

2

There are 2 best solutions below

1
On

Have you tried

$params2 = array('session_id'=>$sessionID, 'api_id' => $api_id,'user'=>        $usr,'password'=>$pwd, 'to'=>array('962xxxxxxx', '962xxxxxxx', '962xxxxxxx'), 'from'=>"thetester",'text'=...

or

$params2 = array('session_id'=>$sessionID, 'api_id' => $api_id,'user'=>        $usr,'password'=>$pwd, 'to'=>array('962xxxxxxx,962xxxxxxx,962xxxxxxx'), 'from'=>"thetester",'text'=...
0
On

Try startbatch command to send multiple messages at the same time (it also supports personalized). However, it is not based soap, it is based http api.