aqlx86 / isms-php

ISMS SMS API 的 PHP 库

1.2 2018-09-30 13:55 UTC

This package is auto-updated.

Last update: 2024-08-29 04:37:04 UTC


README

iSMS PHP 客户端

请检查isms网站上的响应错误代码列表和描述。 https://www.isms.com.my/response_result.php

当前功能

  • 发送 SMS
  • 获取剩余余额

设置

$ composer.phar install

发送 SMS 的示例用法

require './vendor/autoload.php';

use ISMS\Recipient;
use ISMS\Message;
use ISMS\SMS;

$recipient = new Recipient('9999999');
$message = new Message($recipient, 'message to send');
$sms = new SMS('username', 'password', $message);

try
{
    $sms->send();
}
catch (\Exception $e)
{
    var_dump($e->getMessage(), $e->getCode());
}

获取剩余 SMS 余额

require './vendor/autoload.php';

use ISMS\Balance;

$balance = new Balance('username', 'password');

try
{
    echo $balance->get();
}
catch (\Exception $e)
{
    var_dump($e->getMessage(), $e->getCode());
}