txtghana / txtconnect-sms-api
TXTConnect SMS API 是由 Mike-berg Afu 开发的批量短信应用程序
Requires
- php: >=7.0
This package is auto-updated.
Last update: 2024-09-20 21:01:59 UTC
README
TXTGhana SMS API
TXTGhana SMS API 是为 TXTConnect SMS - 营销批量短信应用程序而构建的
先决条件
要运行 TxtGhana SMS API,您必须在服务器上安装 TxtConnect SMS 应用程序。有关更多详细信息,请访问:TXTConnect SMS
php >=5.6
Ultimate SMS - Bulk SMS Application For Markting
安装
通过 Composer
composer require txtghana/txtconnect-sms-api
和通过 Bash
git clone https://github.com/akasham67/ultimate-sms-api.git
用法
步骤 1
如果使用 Git Clone 安装 Ultimate SMS API,请加载 Ultimate SMS API 类文件并使用命名空间。
require_once 'src/Class_Ultimate_SMS_API.php'; use UltimateSMS\UltimateSMSAPI;
如果使用 Composer 安装 Ultimate SMS API,请在项目的 index.php 或您需要使用 Ultimate SMS API 类的任何文件中 Require/Include autoload.php 文件。
require 'vendor/autoload.php'; use UltimateSMS\UltimateSMSAPI;
步骤 2
从 https://mywebhost.com/sms-api/info
(您的应用程序安装 URL)设置您的 API_KEY
$api_key = 'YWRtaW46YWRtaW4ucGFzc3dvcmQ=';
步骤 3
更改以下发件人号码。它可以是一个有效的电话号码或一个字符串
$from = '8801721000000';
步骤 4
我们要发送到的号码 - 任何电话号码
$destination = '8801810000000';
对于多个号码,请在每个单独的号码后面使用逗号 (,)。
$destination = '8801810000000,8801721000000,880167000000,01913000000';
您可以在单个 API 请求中使用逗号插入最多 100 个号码。
您必须在电话号码的开头包含国家代码。
步骤 5
将您的安装 URL(如 https://mywebhost.com/sms/api
)替换为 https://ultimatesms.coderpixel.com/demo/
,sms/api
是您安装 URL 上的必选项
$url = 'https://ultimatesms.coderpixel.com/demo/sms/api';
// SMS 内容
$sms = 'test message from Ultimate SMS';
// Unicode SMS
$unicode = '1'; //For Unicode message
// 语音 SMS
$voice = '1'; //For voice message
// MMS SMS
$mms = '1'; //For mms message $media_url = 'https://yourmediaurl.com'; //Insert your media url
// 定时 SMS
$schedule_date = '09/17/2018 10:20 AM'; //Date like this format: m/d/Y h:i A
// 为请求创建纯文本 SMS 内容
$sms_body = array( 'api_key' => $api_key, 'to' => $destination, 'from' => $from, 'sms' => $sms );
// 为请求创建 Unicode SMS 内容
$sms_body = array( 'api_key' => $api_key, 'to' => $destination, 'from' => $from, 'sms' => $sms, 'unicode' => $unicode, );
// 为请求创建语音 SMS 内容
$sms_body = array( 'api_key' => $api_key, 'to' => $destination, 'from' => $from, 'sms' => $sms, 'voice' => $voice, );
// 为请求创建 MMS SMS 内容
$sms_body = array( 'api_key' => $api_key, 'to' => $destination, 'from' => $from, 'sms' => $sms, //optional 'mms' => $mms, 'media_url' => $media_url, );
// 为请求创建定时 SMS 内容
$sms_body = array( 'api_key' => $api_key, 'to' => $destination, 'from' => $from, 'sms' => $sms, 'schedule' => $schedule_date, );
步骤 6
实例化一个新的 Ultimate SMS API 请求
$client = new UltimateSMSAPI();
发送 SMS
最后通过 Ultimate SMS API 发送您的短信
$response = $client->send_sms($sms_body, $url);
获取收件箱
获取您的所有消息
$get_inbox=$client->get_inbox($api_key,$url);
获取余额
获取您的账户余额
$get_balance=$client->check_balance($api_key,$url);
响应
Ultimate SMS API 以 json
格式返回响应,如下所示
{"code":"ok","message":"Successfully Send"}
状态码
作者
- Abul Kashem Shamim - 初始工作 - akasham67