premiumfastnet/wsgateway

v1.0 2019-11-19 14:49 UTC

README

StyleCI Latest Stable Version Total Downloads License

这个库易于在PHP中使用composer安装。如果您想在自己的编程语言中构建,请参阅我们的REST API 文档

安装

composer require premiumfastnet/wsgateway

如何使用

示例

您可以在example文件夹中查看易于使用的示例。请注意,您需要将config.php.example改为config.php,并填写该文件中的变量以使其工作,或者您可以创建自己的组合。

发送消息示例

  • 请求
<?php

require "vendor/autoload.php";

use PremiumFastNetwork\WSGateway;

$wa = new WSGateway();
$wa->token('YOUR-TOKEN-HERE');
$wa->deviceid('YOUR-DEVICE-ID');
$send = $wa->sendmessage('0812xxxxxxxx', 'test send message by api');
var_dump(json_decode($send));
  • 响应
class stdClass#29 (2) {
  public $code =>
  int(200)
  public $message =>
  string(44) "success, message will be send in background."
}

发送批量消息示例

  • 请求
<?php

require "vendor/autoload.php";

use PremiumFastNetwork\WSGateway;

$wa = new WSGateway();
$wa->token('YOUR-TOKEN-HERE');
$wa->deviceid('YOUR-DEVICE-ID');

$multiplenumber = array(
    '08xxxx', '08xxxxx'
);
$send = $wa->sendmessage($multiplenumber, 'test send message by api');
var_dump(json_decode($send));
  • 响应
class stdClass#29 (2) {
  public $code =>
  int(200)
  public $message =>
  string(37) "success, all message in waiting list."
}

向联系人组发送批量消息

  • 请求
<?php

require "vendor/autoload.php";

use PremiumFastNetwork\WSGateway;

$wa = new WSGateway();
$wa->token('YOUR-TOKEN-HERE');
$wa->deviceid('YOUR-DEVICE-ID');
$send = $wa->sendgroup('xxxxx', 'test send message by api');
var_dump(json_decode($send));
  • 响应
class stdClass#29 (2) {
  public $code =>
  int(200)
  public $message =>
  string(37) "success, all message in waiting list."
}