Asiasms is a SMS service provider system.
If you need integration your website(send and received SMS) with Asiasms, you are in the right place.
- For take username and password contarct with http://asiasms.ir
- The allowed IP must define in asiasms panel
$ composer require dpsoft/asiasms
Get credit of Asiasms panel.
<?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();
}
Send message to list of numbers
<?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();
}
Send message to one number.
<?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();
}
Get list of sms received to panel in date (messages just return one time. the limitation from 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();
}
Get list of sms received to panel between two dates.(range of dates) For get messages in one date set same start and end date .
<?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();
}
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
)
)
Copyright (c) 2018 dpsoft.ir