matix8981 / microsms
MicroSMS支付的非官方API类
1.0.3
2019-04-19 15:25 UTC
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2024-09-20 03:18:11 UTC
README
MicroSMS支付的非官方API类
需求
- PHP 5.6+
待办事项
- 在线转账
Composer
composer require matix8981/microsms
在composer.json
中指定以下内容
{ "require": { "matix8981/microsms": "dev-master" } }
用于短信高级支付的简单用法
在多个号码上检查短信验证码
<?php require_once("vendor/autoload.php"); $settings = [ "clientID" => 1234, "serviceID" => 1234, ]; try { $api = new Matix8981\MicroSMS\SMS($settings["clientID"], $settings["serviceID"]); /** * Example return * array(2) { ["connect"]=> bool(true) ["data"]=> array(6) { ["status"]=> int(1) ["used"]=> NULL ["service"]=> string(4) "6205" ["number"]=> string(5) "92550" ["phone"]=> string(11) "48123456789" ["reply"]=> string(69) "Twoj kod dostepu to: XYZ. Dziekujemy za zakupy w naszym sklepie." } } */ $api->ValidateMulti($_GET["code"]); /** * Example format return * array(6) { ["status"]=> bool(true) ["used"]=> bool(false) ["service"]=> string(4) "6205" ["number"]=> string(5) "92550" ["phone"]=> string(11) "48123456789" ["reply"]=> string(69) "Twoj kod dostepu to: XYZ. Dziekujemy za zakupy w naszym sklepie." } */ $api->ValidateResult(); } catch(Exception $error) { echo "Error: ".$error->getMessage(); } ?>
在单个号码上检查短信验证码
<?php require_once("vendor/autoload.php"); $settings = [ "clientID" => 1234, "serviceID" => 1234, ]; try { $api = new Matix8981\MicroSMS\SMS($settings["clientID"], $settings["serviceID"]); /** * Example return * array(2) { ["connect"]=> bool(true) ["data"]=> array(5) { ["status"]=> int(1) ["service"]=> string(4) "6205" ["number"]=> string(5) "92550" ["phone"]=> string(11) "48123456789" ["reply"]=> string(69) "Twoj kod dostepu to: XYZ. Dziekujemy za zakupy w naszym sklepie." } } */ $api->ValidateSingle($_GET["code"], $_GET["number"]); /** * Example format return * array(6) { ["status"]=> bool(true) ["used"]=> bool(false) ["service"]=> string(4) "6205" ["number"]=> string(5) "92550" ["phone"]=> string(11) "48123456789" ["reply"]=> string(69) "Twoj kod dostepu to: XYZ. Dziekujemy za zakupy w naszym sklepie." } */ $api->ValidateResult(); } catch(Exception $error) { echo "Error: ".$error->getMessage(); } ?>