簡體   English   中英

如何阻止 smsgateway 發送更多消息

[英]How can I stop smsgateway from sending any more messages

我有一點問題,我創建了下面的函數:

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 調用來停止消息,而且他們網站的電子郵件是錯誤的,我可以不要給他們發任何電子郵件,我也沒有任何國際長途電話。

我不想這么說,但你完蛋了。 如果提供者沒有提供清除隊列的方法,它們將被發送。

下一次,通過首先用 echo 語句替換代碼的發送位來更仔細地測試。 想想如果你錯誤地創建了一個無限循環會發生什么......

我發現如果您刪除設備,它也會刪除該設備的排隊消息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM