使用smsGateway.me API

时间:2018-05-19 07:26:04

标签: php

在向单个号码发送邮件时收到错误消息。

{  
   "response":{  
      "success":false,
      "errors":{  
         "id":"No device found with that ID"
      }
   },
   "status":422
}

{  
   "response":{  
      "success":true,
      "result":{  
         "id":90841,
         "name":"New Device",
         "make":"General Mobile",
         "model":"General Mobile 4G",
         "number":"",
         "provider":"Airtel",
         "country":"tz",
         "connect_type":"3G",
         "battery":77,
         "signal":75,
         "wifi":false,
         "lat":"0",
         "lng":"0",
         "last_seen":"1526713626",
         "created_at":"1526681354",
         "updated_at":"1526713626"
      }
   },
   "status":200
}

第一个响应是向一个号码发送消息,第二个响应是使用DeviceID获取设备详细信息。用于获取设备详细信息和向号码发送消息的DeviceID是相同的这是我的PHP代码

<?php

require_once 'smsGateway.php'; $number='07****XXXX'; $message="Hi ";


$smsGateway = new SmsGateway('user@gmai.com', '****');

$deviceID = 90841;

/*$options = [ 'send_at' => strtotime('+1 minutes'), // Send the message in 10 minutes 'expires_at' => strtotime('+1 hour') // Cancel the message in 1 hour if the message is not yet sent ];
*/ //Please note options is no required and can be left out $result = $smsGateway->sendMessageToNumber('0715605476', $message,2/*, $options*/); $devices = $smsGateway->getDevice($deviceID);


echo json_encode($result)."<br><br>".json_encode($devices);


?>

0 个答案:

没有答案