dpsoft/asiasms

该包的最新版本(v1.1.0)没有可用的许可证信息。

Asiasms restful web服务

v1.1.0 2018-10-16 06:45 UTC

This package is auto-updated.

Last update: 2024-09-25 19:23:54 UTC


README

License: GPL v2

Asiasms是一个短信服务提供商系统。

适合我吗?

如果您需要将您的网站(发送和接收短信)与Asiasms集成,您就在正确的位置。

需求

  • 要获取用户名和密码,请联系 http://asiasms.ir
  • 允许的IP必须在asiasms面板中定义

安装

$ composer require dpsoft/asiasms

方法

GetCredit

获取Asiasms面板的信用额度。

<?php use Dpsoft\Asiasms\Asiasms;

try{
    /**
      *@param string $username (required) Asiasms panel username 
      * 
      *@param string $password (required) webservice password set in Asiasms panel.
      */
    $asiasms = new Asiasms($username, $password);
    echo $asiasms->getCredit();
}catch (\Throwable $exception){
    echo $exception->getMessage();
}

bulkSend

向号码列表发送消息

<?php use Dpsoft\Asiasms\Asiasms;

try{
    /**
      *@param string $username (required) Asiasms panel username 
      * 
      *@param string $password (required) webservice password set in Asiasms panel.
      */
    $asiasms = new Asiasms($username, $password);
    
    /**
      *@param string $message (required) message text
      *@param array $receivers (required) example: ['09100000000', '09111111111'] should be in 09xxxxxxx mask
      *@param string $senderId = null (optional) the number sms send with it(must exist in panel) default panel default number 
      *@param string $udh = null (optional)
      *@param bool $isFlash = null (optional) if send bool true or false the webservice not work
      */
    $batchId = $asiasms->bulkSend($message, $receivers, $senderId, $udh, $isFlash);
}catch (\Throwable $exception){
    echo $exception->getMessage();
}

发送

向一个号码发送消息。

<?php use Dpsoft\Asiasms\Asiasms;

try{
    /**
      *@param string $username (required) Asiasms panel username 
      * 
      *@param string $password (required) webservice password set in Asiasms panel.
      */
    $asiasms = new Asiasms($username, $password);
    
    /**
      *@param string $message (required) message text
      *@param string $number (required) example: '09100000000' the receiver number
      *@param string $senderId = null (optional) the number sms send with it(must exist in panel)
      *@param string $udh = null (optional)
      *@param bool $isFlash = null (optional) if send bool true or false the webservice not work
      */
    $batchId = $asiasms->send($message, $number, $senderId, $udh, $isFlash);
}catch (\Throwable $exception){
    echo $exception->getMessage();
}

GetMessage

在指定日期(消息只返回一次。来自Asiasms的限制)中获取发送到面板的短信列表

<?php use Dpsoft\Asiasms\Asiasms;

try{
    /**
      *@param string $username (required) asiasms panel username 
      * 
      *@param string $password (required) webservice password set in Asiasms panel.
      */
    $asiasms = new Asiasms($username, $password);
    
    /**
      *@param string $date (required) date for get report in any valid date format
      *@param string $receiver = '' (optional) panel number
      *
      *return array of messages
      */
    $messages = $asiasms->getMessages($date, $receiver);
    
    print_r($messages);
}catch (\Throwable $exception){
    echo $exception->getMessage();
}

GetMessagesBetweenDate

在两个日期之间获取发送到面板的短信列表。(日期范围)要获取某个日期的消息,请设置相同的开始和结束日期。

<?php use Dpsoft\Asiasms\Asiasms;

try{
    /**
      *@param string $username (required) asiasms panel username 
      * 
      *@param string $password (required) webservice password set in Asiasms panel.
      */
    $asiasms = new Asiasms($username, $password);
    
    /**
      *@param string $startDate (required) in any valid date format
      *@param string $endDate (required) in any valid date format
      *@param string $receiver = '' (optional) panel number
      *
      *return array of messages
      */
    $messages = $asiasms->getMessagesBetweenDate($startDate, $endDate, $receiver);
    
    print_r($messages);
}catch (\Throwable $exception){
    echo $exception->getMessage();
}

从Asiasms面板返回消息数组的示例

Array
(
    [0] => Array
        (
            [From] => 98913xxxxxxx
            [To] => 3000xxxxxx
            [Text] => Message text
            [ReceiveDateTime] => 2018-10-14T17:46:29
        )

    [1] => Array
        (
            [From] => 98913xxxxxxx
            [To] => 3000xxxxxx
            [Text] => Message text for test
            [ReceiveDateTime] => 2018-10-14T18:10:40
        )
)

许可证

License: GPL v2

版权所有(c)2018 dpsoft.ir