tomatom/sms-gateway-client

用于加密和向SmsGateway服务器发送请求的简单库

dev-master 2018-05-02 12:26 UTC

This package is auto-updated.

Last update: 2024-09-23 01:30:32 UTC


README

用法

  • 设置SERVER_URI常量,

  • 调用encrypt方法

SmsGatewayClientUtil::encrypt(clientId, privKey, data);

  • 或者调用sendRaw方法(主要用于测试目的)

SmsGatewayClientUtil::sendRaw(clientId, data);

其中data是一个类似以下关联数组


[

'sendTo' => '+420123456789',

'country' => 'cs',

'msg' => 'foo bar baz'

];


(sendTo可以带有或不带有国家前缀)

  • 在成功的情况下,你应该得到以下类似的响应

{

"status": "success",

"details": {

  "id": 456,
  "deviceId": null,
  "messageUuid": "e1ff8-41cde-b3c60",
  "sentTimestamp": 1234567890,
  "from": null,
  "sendTo": "775076596",
  "message": "foo bar baz",
  "sentResultCode": null,
  "sentResultMessage": null,
  "deliveredResultCode": null,
  "deliveredResultMessage": null,
  "type": "sent",
  "sendNow": true,
  "waitingForDeliveryInfo": null

}

}

  • 或者当发生错误时,如下所示

{

"status": "error",

"details": "country denied for client"

}

  • 在这种情况下,请检查你是否发送了有效的country,并且该国家与sendTo中的电话号码相匹配