urhitech / urhitech-sms-php
Urhitech批量短信API的PHP SDK
v1.0.0
2021-11-22 14:40 UTC
Requires
- php: >=5.3.0
- ext-curl: *
README
Urhitech SMS PHP SDK为从PHP编写的应用程序提供了一种适合USMSGH API的解决方案。它包括一组预定义的类和函数,这些类和函数可以从API响应中初始化自身。
该库还提供其他功能。例如
- 快速设置和使用的简单配置路径
- 分页助手。
您可以在usmsgh.com注册USMSGH账户
先决条件
PHP 5.6.0及以后版本
安装
通过Composer
composer require urhitech/urhitech-sms-php
通过Git Bash
git clone https://github.com/sefakor20/urhitech-sms-php.git
文档
请参阅https://usmsgh.com/developer/以获取最新的文档
用法
步骤1
如果您通过Git Clone安装了Urhitech SMS PHP SDK,则加载Urhitech SMS PHP API类文件并使用命名空间。
require_once '/path/to/src/Usms.php'; use Urhitech\Usms;
如果您通过Composer安装了Urhitech SMS PHP SDK,则需要在项目的index.php文件或您需要使用Urhitech SMS PHP API类的任何文件中要求autoload.php文件。
require __DIR__ . '/vendor/autoload.php'; use Urhitech\Usms;
Urhitech SMS PHP SDK端点是RESTful的,消费和返回JSON。所有HTTP端点都需要在请求头中包含API密钥。
有关如何获取API密钥的更多信息,请访问此处复制或生成新的授权密钥。
HTTP端点
- https://webapp.usmsgh.com/api/sms/send
- https://webapp.usmsgh.com/api/sms/{uid}
- https://webapp.usmsgh.com/api/sms
- https://webapp.usmsgh.com/api/me
- https://webapp.usmsgh.com/api/balance
- https://webapp.usmsgh.com/api/contacts
- https://webapp.usmsgh.com/api/contacts/{group_id}/show/
- https://webapp.usmsgh.com/api/contacts/{group_id}
- https://webapp.usmsgh.com/api/contacts/{group_id}/store
- https://webapp.usmsgh.com/api/contacts/{group_id}/search/{uid}
- https://webapp.usmsgh.com/api/contacts/{group_id}/update/{uid}
- https://webapp.usmsgh.com/api/contacts/{group_id}/delete/{uid}
- https://webapp.usmsgh.com/api/contacts/{group_id}/all
步骤2
实例化UrhitechSMSPHPAPI
$client = new Urhitech\Usms;
发送短信
$api_key = "Enter Your API Key here"; $url = "https://webapp.usmsgh.com/api/sms/send"; $recipients = "233500000000,233540000000"; $message = "Hello world"; $senderid = "Enter your approved sender ID here"; $response = $client->send_sms($url, $api_key, $senderid, $recipients, $message);
检查短信余额
$api_key = "Enter Your API Key here"; $url = "https://webapp.usmsgh.com/api/balance"; $get_credit_balance = $client->check_balance($url, $api_key);
查看配置文件
$api_key = "Enter Your API Key here"; $url = "https://webapp.usmsgh.com/api/me"; $get_profile = $client->profile($url, $api_key);