【问题标题】:sending multiple messages using clickatell gateway使用 clickatell 网关发送多条消息
【发布时间】:2013-08-16 01:43:31
【问题描述】:

我使用php服务器端连接clickatell消息服务,我使用soap api技术进行连接。它正在工作。但在我的代码中,我只能同时发送一条消息,这是代码:

    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';


      }

....现在您看到此代码将同时发送一条消息,忘记id,它是出于个人目的,现在我必须修改此服务,以同时发送多条消息,我会给每条消息一个唯一的ID,所以现在我的问题是:有没有人知道是否有服务可以同时发送多个短信?

在我的代码中,我填写了一条消息的信息,但我需要一个服务来发送多条短信,是否有任何机构可以给我一个该服务的链接,我进行了很多搜索,但没有找到答案

【问题讨论】:

    标签: php clickatell


    【解决方案1】:

    你试过了吗

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

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

    【讨论】:

    • 你的答案会向不同的人发送相同的文本,而且文本字段不是一个数组,所以我们仍然有同样的问题,即同时发送多条消息,我可以循环但我认为有一种方法可以处理发送多条消息,即使有一个小技巧可能会对我有所帮助,但无论如何都感谢
    【解决方案2】:

    尝试startbatch命令同时发送多条消息(也支持个性化)。但是,它不是基于soap,而是基于http api。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-04
      • 1970-01-01
      • 1970-01-01
      • 2021-01-12
      相关资源
      最近更新 更多