premiumfastnet / wsgateway
WSGateway API 的库包
v1.0
2019-11-19 14:49 UTC
Requires
- guzzlehttp/guzzle: ^6.4
This package is auto-updated.
Last update: 2024-09-19 22:25:13 UTC
README
这个库易于在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."
}