2016-10-04 52 views
-1

我有一个有点问题停止smsgateway,我创建了以下功能:我怎么能发送任何更多的消息

function sendQuedMessagesByDeviceAndDate($deviceId){ 
    require_once 'php/classes/smsGateway.php'; 
    $smsGateway = new SmsGateway(SMS_GATEWAY_EMAIL, SMS_GATEWAY_PASSWORD); 
    $result = $smsGateway->getQuedMessages($deviceId); 
    $arr = $result['response']['result']; 
    $data = array(); 
    $options = [ 
     'expires_at' => strtotime('+24 hours') // Cancel the message in 24 hours if the message is not yet sent 
    ]; 
    foreach($arr as $res){ 
     if($res['status'] == 'queued' && $res['device_id'] == $deviceId && $res['queued_at'] > 1475452800 && $res['queued_at'] < 1475539200){ 
      array_push($data, $res); 
     } 
    } 
    //$nrs = array(); 
    foreach($data as $mes){ 
     $smsGateway->sendMessageToNumber($mes['contact']['number'], $mes['message'], $deviceId, $options); 
    } 
    //return $data; 
} 

,我已经叫起作用的错误5-6次,怎么能我告诉服务器来自smsgateway停止发送消息,我找不到任何API调用来停止消息,并且来自他们网站的电子邮件是错误的,我不能给他们发送任何电子邮件,并且我没有任何国际拨打电话。

回答

0

我不想说这个,但你搞砸了。如果提供者没有提供清除队列的方法,它们将被发送。

下一次,通过首先用echo语句替换代码的发送位来仔细测试。试想会发生什么,如果你已经创建了错误的无限循环......

0

我发现,如果你删除设备,它还会删除该设备的排队消息

相关问题