Last active
June 7, 2023 13:11
-
-
Save movahhedi/6b369e16517e8b5f94ae065089ff5f23 to your computer and use it in GitHub Desktop.
SMS.IR Full PHP Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Shahab Movahhedi <dev@shmovahhedi.com> | |
* @copyright © 2022 Shahab Movahhedi. All rights reserved. | |
* @link http://sms.ir/ Documentation of sms.ir RESTful API PHP sample. | |
* @version 1.2 | |
*/ | |
class SmsIr { | |
const ApiUrlPrefix = 'http://RestfulSms.com/api/'; | |
const ApiUrl_Token = 'Token'; | |
const ApiUrl_MessageSend = 'MessageSend'; | |
const ApiUrl_UltraFastSend = 'UltraFastSend'; | |
const ApiUrl_SMSLine = 'SMSLine'; | |
const ApiUrl_MessageReceive = 'ReceiveMessage'; | |
const ApiUrl_VerificationCode = 'VerificationCode'; | |
const ApiUrl_Credit = 'credit'; | |
const ApiUrl_CustomerClubContact = 'CustomerClubContact'; | |
const ApiUrl_CustomerClubContact_GetCategories = 'CustomerClubContact/GetCategories'; | |
const ApiUrl_CustomerClubContact_GetContactsByCategoryById = 'CustomerClubContact/GetContactsByCategoryById'; | |
const ApiUrl_CustomerClubContact_GetContacts = 'CustomerClubContact/GetContacts'; | |
const ApiUrl_CustomerClub_AddContactAndSend = 'CustomerClub/AddContactAndSend'; | |
const ApiUrl_CustomerClub_Send = 'CustomerClub/Send'; | |
const ApiUrl_CustomerClub_SendToCategories = 'CustomerClub/SendToCategories'; | |
const ApiUrl_CustomerClub_GetSendMessagesByPaginationAndLastId = 'CustomerClub/GetSendMessagesByPaginationAndLastId'; // CustomerClubContact? | |
const ApiUrl_CustomerClub_GetSendMessagesByPagination = 'CustomerClub/GetSendMessagesByPagination'; // CustomerClubContact? | |
private $APIKey; | |
private $SecretKey; | |
private $LineNumber; | |
/** | |
* Gets config parameters for sending request. | |
* | |
* @param string $APIKey API Key | |
* @param string $SecretKey Secret Key | |
* @param string $LineNumber Line Number | |
* @return void | |
*/ | |
public function __construct($APIKey, $SecretKey, $LineNumber = 0) { | |
$this->APIKey = $APIKey; | |
$this->SecretKey = $SecretKey; | |
$this->LineNumber = $LineNumber; | |
} | |
/** | |
* Add Contact To Customer Club. | |
* | |
* @param string $Prefix Prefix | |
* @param string $FirstName First Name | |
* @param string $LastName Last Name | |
* @param string $Mobile Mobile | |
* @param string $BirthDay Birth Day | |
* @param string $CategoryId Category Id | |
* @return string The result | |
*/ | |
public function AddContactToCustomerClub($Prefix, $FirstName, $LastName, $Mobile, $BirthDay, $CategoryId) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$postData = [ | |
'Prefix' => $Prefix, | |
'FirstName' => $FirstName, | |
'LastName' => $LastName, | |
'Mobile' => $Mobile, | |
'BirthDay' => $BirthDay, | |
'CategoryId' => $CategoryId | |
]; | |
$url = self::ApiUrl_CustomerClubContact; | |
$AddContactToCustomerClub = $this->execute($url, $token, $postData); | |
$object = json_decode($AddContactToCustomerClub); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Customer Club Insert And Send Message. | |
* | |
* @param data[] $data array structure of contacts data | |
* @return string The result | |
*/ | |
public function CustomerClubInsertAndSendMessage($postData) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_CustomerClub_AddContactAndSend; | |
$CustomerClubInsertAndSendMessage = $this->execute($url, $token, $postData); | |
$object = json_decode($CustomerClubInsertAndSendMessage); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* send sms to Customer Club Contacts. | |
* | |
* @param MobileNumbers[] $MobileNumbers array structure of mobile numbers | |
* @param Messages[] $Messages array structure of messages | |
* @param string $SendDateTime Send Date Time | |
* @return string The result | |
*/ | |
public function CustomerClubSend($MobileNumbers, $Messages, $SendDateTime = '') { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$postData = [ | |
'Messages' => $Messages, | |
'MobileNumbers' => $MobileNumbers, | |
'SendDateTime' => $SendDateTime, | |
'CanContinueInCaseOfError' => 'false' | |
]; | |
$url = self::ApiUrl_CustomerClub_Send; | |
$CustomerClubSend = $this->execute($url, $token, $postData); | |
$object = json_decode($CustomerClubSend); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Customer Club Send To Categories. | |
* | |
* @param Messages[] $Messages array structure of messages | |
* @param contactsCustomerClubCategoryIds[] $contactsCustomerClubCategoryIds array structure of contacts Customer Club Category Ids | |
* @param string $SendDateTime Send Date Time | |
* @return string The result | |
*/ | |
public function CustomerClubSendToCategories($Messages, $contactsCustomerClubCategoryIds, $SendDateTime = '') { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$postData = [ | |
'Messages' => $Messages, | |
'contactsCustomerClubCategoryIds' => $contactsCustomerClubCategoryIds, | |
'SendDateTime' => $SendDateTime, | |
'CanContinueInCaseOfError' => 'false' | |
]; | |
$url = self::ApiUrl_CustomerClub_SendToCategories; | |
$CustomerClubSendToCategories = $this->execute($url, $token, $postData); | |
$object = json_decode($CustomerClubSendToCategories); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Edit Contact of Customer Club. | |
* | |
* @param string $Prefix Prefix | |
* @param string $FirstName First Name | |
* @param string $LastName Last Name | |
* @param string $Mobile Mobile | |
* @param string $BirthDay Birth Day | |
* @param string $CategoryId Category Id | |
* @return string The result | |
*/ | |
public function EditCustomerClubContact($Prefix, $FirstName, $LastName, $Mobile, $BirthDay, $CategoryId) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$postData = [ | |
'Prefix' => $Prefix, | |
'FirstName' => $FirstName, | |
'LastName' => $LastName, | |
'Mobile' => $Mobile, | |
'BirthDay' => $BirthDay, | |
'CategoryId' => $CategoryId | |
]; | |
$url = self::ApiUrl_CustomerClubContact; | |
$EditCustomerClubContact = $this->execute($url, $token, $postData); | |
$object = json_decode($EditCustomerClubContact); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Get Credit. | |
* | |
* @return string The result | |
*/ | |
public function GetCredit() { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_Credit; | |
$GetCredit = $this->execute($url, $token); | |
$object = json_decode($GetCredit); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['IsSuccessful'] ? $array['Credit'] : $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Get Customer Club Categories. | |
* | |
* @return string Indicates the contact categories result | |
*/ | |
public function GetCustomerClubCategories() { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_CustomerClubContact_GetCategories; | |
$GetCustomerClubCategories = $this->execute($url, $token); | |
$object = json_decode($GetCustomerClubCategories); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['ContactsCustomerClubCategories']; | |
} | |
else return false; | |
} | |
return false; | |
} | |
/** | |
* Get Customer Club Categories. | |
* | |
* @return string Indicates the contact categories result | |
*/ | |
public function GetCustomerClubContactsByCategoryIdByPageId($categoryId, $pageId) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_CustomerClubContact_GetContactsByCategoryById . '?categoryId=' . $categoryId . '&pageNumber=' . $pageId; | |
$GetCustomerClubContactsByCategoryIdByPageId = $this->execute($url, $token); | |
$object = json_decode($GetCustomerClubContactsByCategoryIdByPageId); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['ContactsCustomerClubResponseDetails']; | |
} | |
else return false; | |
} | |
return false; | |
} | |
/** | |
* Get Customer Club contacts. | |
* | |
* @return string Indicates the contact result | |
*/ | |
public function GetCustomerClubContactsByPageId($pageId) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_CustomerClubContact_GetContacts . '?pageNumber=' . $pageId; | |
$GetCustomerClubContactsByPageId = $this->execute($url, $token); | |
$object = json_decode($GetCustomerClubContactsByPageId); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['ContactsCustomerClubResponseDetails']; | |
} | |
else return false; | |
} | |
return false; | |
} | |
/** | |
* Get Customer Club Sent Messages. | |
* | |
* @return string Indicates the Sent Messages result | |
*/ | |
public function GetCustomerClubSentMessagesByLastId($lastId) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_CustomerClub_GetSendMessagesByPaginationAndLastId . '?lastId=' . $lastId; | |
$GetCustomerClubSentMessagesByLastId = $this->execute($url, $token); | |
$object = json_decode($GetCustomerClubSentMessagesByLastId); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['ContactsCustomerClubResponseDetails']; | |
} | |
else return false; | |
} | |
return false; | |
} | |
/** | |
* Get Customer Club Sent Messages. | |
* | |
* @return string Indicates the Sent Messages result | |
*/ | |
public function GetCustomerClubSentMessagesByPageId($pageId, $rowCount) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_CustomerClub_GetSendMessagesByPagination . '?pageIndex=' . $pageId . '&rowCount=' . $rowCount; | |
$GetCustomerClubSentMessagesByPageId = $this->execute($url, $token); | |
$object = json_decode($GetCustomerClubSentMessagesByPageId); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['ContactsCustomerClubResponseDetails']; | |
} | |
else return false; | |
} | |
return false; | |
} | |
/** | |
* Get Sms Lines. | |
* | |
* @return string The result | |
*/ | |
public function GetSmsLines() { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_SMSLine; | |
$GetSmsLines = $this->execute($url, $token); | |
$object = json_decode($GetSmsLines); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['IsSuccessful'] ? $array['SMSLines'] : $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Gets Receive Message By BatchKey And PageId. | |
* | |
* @param string $pageId page id for getting messages | |
* @param string $batchKey sent messages batchkey | |
* @return string The result | |
*/ | |
public function ReceiveMessageByBatchKeyAndPageId($pageId, $batchKey) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_MessageSend . '?pageId=' . $pageId . '&batchKey=' . $batchKey; | |
$ReceiveMessageByBatchKeyAndPageId = $this->execute($url, $token); | |
$object = json_decode($ReceiveMessageByBatchKeyAndPageId); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['IsSuccessful'] ? $array['Messages'] : $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Gets Sent Message Response By Date. | |
* | |
* @param string $Shamsi_FromDate Shamsi From Date | |
* @param string $Shamsi_ToDate Shamsi To Date | |
* @param string $RowsPerPage Rows Per Page | |
* @param string $RequestedPageNumber Requested Page Number | |
* @return string The result | |
*/ | |
public function ReceiveMessageResponseByDate($Shamsi_FromDate, $Shamsi_ToDate, $RowsPerPage, $RequestedPageNumber) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_MessageReceive . '?Shamsi_FromDate=' . $Shamsi_FromDate . '&Shamsi_ToDate=' . $Shamsi_ToDate . '&RowsPerPage=' . $RowsPerPage . '&RequestedPageNumber=' . $RequestedPageNumber; | |
$ReceiveMessageResponseByDate = $this->execute($url, $token); | |
$object = json_decode($ReceiveMessageResponseByDate); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['IsSuccessful'] ? $array['Messages'] : $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Receive Message By Last Id. | |
* | |
* @param string $id messages id | |
* @return string The result | |
*/ | |
public function ReceiveMessageByLastId($id) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_MessageReceive . '?id=' . $id; | |
$ReceiveMessageByLastId = $this->execute($url, $token); | |
$object = json_decode($ReceiveMessageByLastId); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['IsSuccessful'] ? $array['Messages'] : $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Send Normal SMS. | |
* | |
* @param MobileNumbers[] $MobileNumbers array structure of mobile numbers | |
* @param Messages[] $Messages array structure of messages | |
* @param string $SendDateTime Send Date Time | |
* @return string The result | |
*/ | |
public function SendMessage($MobileNumbers, $Messages, $SendDateTime = '') { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$postData = [ | |
'Messages' => $Messages, | |
'MobileNumbers' => $MobileNumbers, | |
'LineNumber' => $this->LineNumber, | |
'SendDateTime' => $SendDateTime, | |
'CanContinueInCaseOfError' => 'false' | |
]; | |
$url = self::ApiUrl_MessageSend; | |
$SendMessage = $this->execute($url, $token, $postData); | |
$object = json_decode($SendMessage); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Gets Sent Message Response By Date. | |
* | |
* @param string $Shamsi_FromDate Shamsi From Date | |
* @param string $Shamsi_ToDate Shamsi To Date | |
* @param string $RowsPerPage Rows Per Page | |
* @param string $RequestedPageNumber Requested Page Number | |
* @return string The result | |
*/ | |
public function SentMessageResponseByDate($Shamsi_FromDate, $Shamsi_ToDate, $RowsPerPage, $RequestedPageNumber) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_MessageSend . '?Shamsi_FromDate=' . $Shamsi_FromDate . '&Shamsi_ToDate=' . $Shamsi_ToDate . '&RowsPerPage=' . $RowsPerPage . '&RequestedPageNumber=' . $RequestedPageNumber; | |
$SentMessageResponseByDate = $this->execute($url, $token); | |
$object = json_decode($SentMessageResponseByDate); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['IsSuccessful'] ? $array['Messages'] : $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Sent Message Response By Id. | |
* | |
* @param string $id message id | |
* @return string The result | |
*/ | |
public function SentMessageResponseById($id) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_MessageSend . '?id=' . $id; | |
$SentMessageResponseById = $this->execute($url, $token); | |
$object = json_decode($SentMessageResponseById); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['IsSuccessful'] ? $array['Messages'] : $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Ultra Fast Send Message. | |
* | |
* @param data[] $data array structure of message data | |
* @return string The result | |
*/ | |
public function UltraFastSend($postData) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$url = self::ApiUrl_UltraFastSend; | |
$UltraFastSend = $this->execute($url, $token, $postData); | |
$object = json_decode($UltraFastSend); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Verification Code. | |
* | |
* @param string $Code Code | |
* @param string $MobileNumber Mobile Number | |
* @return string The result | |
*/ | |
public function VerificationCode($Code, $MobileNumber) { | |
$token = $this->GetToken($this->APIKey, $this->SecretKey); | |
if ($token) { | |
$postData = [ | |
'Code' => $Code, | |
'MobileNumber' => $MobileNumber, | |
]; | |
$url = self::ApiUrl_VerificationCode; | |
$VerificationCode = $this->execute($url, $token, $postData); | |
$object = json_decode($VerificationCode); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return $array['Message']; | |
} | |
return false; | |
} | |
return false; | |
} | |
/** | |
* Gets token key for all web service requests. | |
* | |
* @return string Indicates the token key | |
*/ | |
public function GetToken() { | |
$postData = [ | |
'UserApiKey' => $this->APIKey, | |
'SecretKey' => $this->SecretKey, | |
'System' => 'php_rest_v_1_2' | |
]; | |
$url = self::ApiUrl_Token; | |
$response = $this->execute($url, false, $postData); | |
$object = json_decode($response); | |
if (is_object($object) && is_array($array = get_object_vars($object))) { | |
return @$array['IsSuccessful'] ? @$array['TokenKey'] : false; | |
} | |
return false; | |
} | |
/** | |
* Executes the main method. | |
* | |
* @param string $url url | |
* @param string $token token string | |
* @param string[] $postData array of json data | |
* @return string Indicates the curl execute result | |
*/ | |
private function execute($url, $token = false, $postData = false) { | |
$postString = json_encode($postData); | |
$ch = curl_init(self::ApiUrlPrefix . $url); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, [ | |
'Content-Type: application/json', | |
($token ? ('x-sms-ir-secure-token: ' . $token) : '') | |
]); | |
curl_setopt($ch, CURLOPT_HEADER, false); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | |
if ($postData) { | |
curl_setopt($ch, CURLOPT_POST, true); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); | |
} | |
$result = curl_exec($ch); | |
curl_close($ch); | |
return $result; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Shahab Movahhedi <dev@shmovahhedi.com> | |
* @copyright © 2022 Shahab Movahhedi. All rights reserved. | |
* @link http://sms.ir/ Documentation of sms.ir RESTful API PHP sample. | |
* @version 2.0 | |
*/ | |
include_once 'SmsIr.php'; | |
/* | |
// It's better to use this class with try-catch | |
try { | |
// Code... | |
var_dump($Result); | |
} catch (Exception $e) { | |
echo 'SMS.IR ERROR: '.$e->getMessage(); | |
} | |
*/ | |
date_default_timezone_set("Asia/Tehran"); | |
// Your SMS.IR panel configuration | |
$APIKey = "enter your api key ..."; | |
$SecretKey = "enter your secret key ..."; | |
$mySmsIr = new SmsIr($APIKey, $SecretKey); | |
// AddContactToCustomerClub | |
$Prefix = 'Mr'; | |
$FirstName = 'FirstName'; | |
$LastName = 'LastName'; | |
$Mobile = '091xxxxxxxx'; | |
$BirthDay = '1370/01/01'; | |
$CategoryId = ''; | |
$Result = $mySmsIr->AddContactToCustomerClub($Prefix, $FirstName, $LastName, $Mobile, $BirthDay, $CategoryId); | |
// CustomerClubInsertAndSendMessage | |
$data = array( | |
array( | |
"Prefix" => "Mr", | |
"FirstName" => "FirstName" , | |
"LastName" => "LastName", | |
"Mobile" => "091xxxxxxxx", | |
"BirthDay" => "1370/01/01", | |
"CategoryId" => "", | |
"MessageText" => "text1" | |
), | |
array( | |
"Prefix" => "Mr2", | |
"FirstName" => "FirstName2" , | |
"LastName" => "LastName2", | |
"Mobile" => "092xxxxxxxx", | |
"BirthDay" => "1370/02/02", | |
"CategoryId" => "", | |
"MessageText" => "text2" | |
) | |
); | |
$Result = $mySmsIr->CustomerClubInsertAndSendMessage($data); | |
// CustomerClubSend | |
$MobileNumbers = array('091xxxxxxxx', '092xxxxxxxx', '093xxxxxxxx'); | |
$Messages = array('text1', 'text2', 'text3'); | |
@$SendDateTime = date("Y-m-d")."T".date("H:i:s"); | |
$Result = $mySmsIr->CustomerClubSend($MobileNumbers, $Messages, $SendDateTime); | |
// CustomerClubSendToCategories | |
$Messages = 'text'; | |
// your Customer Club contacts Category Ids. If it doesn't have any value then sends to all customer club contacts. To send to all, leave the array empty | |
$contactsCustomerClubCategoryIds = array(1, 2); | |
@$SendDateTime = date("Y-m-d")."T".date("H:i:s"); | |
$Result = $mySmsIr->CustomerClubSendToCategories($Messages, $contactsCustomerClubCategoryIds, $SendDateTime); | |
// EditCustomerClubContact | |
$Prefix = 'Mr'; | |
$FirstName = 'FirstName'; | |
$LastName = 'LastName'; | |
$Mobile = '091xxxxxxxx'; | |
$BirthDay = '1370/01/01'; | |
$CategoryId = ''; | |
$Result = $mySmsIr->EditCustomerClubContact($Prefix, $FirstName, $LastName, $Mobile, $BirthDay, $CategoryId); | |
// GetCredit | |
$Result = $mySmsIr->GetCredit(); | |
// GetCustomerClubCategories | |
$Result = $mySmsIr->GetCustomerClubCategories(); | |
// GetCustomerClubCategories | |
$categoryId = 0; | |
$pageId = 1; | |
$Result = $mySmsIr->GetCustomerClubContactsByCategoryIdByPageId($categoryId, $pageId); | |
// GetCustomerClubContactsByPageId | |
$pageId = 1; | |
$Result = $mySmsIr->GetCustomerClubContactsByPageId($pageId); | |
// GetCustomerClubSentMessagesByLastId | |
$lastId = 1; | |
$Result = $mySmsIr->GetCustomerClubSentMessagesByLastId($lastId); | |
// GetCustomerClubSentMessagesByPageId | |
$pageId = 1; | |
$rowCount = 10; | |
$Result = $mySmsIr->GetCustomerClubSentMessagesByPageId($pageId, $rowCount); | |
// GetSmsLines | |
$Result = $mySmsIr->GetSmsLines(); | |
// GetToken | |
$Result = $mySmsIr->GetToken(); | |
// GetToken | |
$batchKey = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'; | |
$pageId = 1; | |
$Result = $mySmsIr->ReceiveMessageByBatchKeyAndPageId($pageId, $batchKey); | |
// ReceiveMessageResponseByDate | |
$Shamsi_FromDate = '1397/02/1'; | |
$Shamsi_ToDate = '1397/02/31'; | |
$RowsPerPage = 10; | |
$RequestedPageNumber = 1; | |
$Result = $mySmsIr->ReceiveMessageResponseByDate($Shamsi_FromDate, $Shamsi_ToDate, $RowsPerPage, $RequestedPageNumber); | |
// ReceiveMessageByLastId | |
$id = 1; | |
$Result = $mySmsIr->ReceiveMessageByLastId($id); | |
// SendMessage | |
$MobileNumbers = array('091xxxxxxxx', '092xxxxxxxx', '093xxxxxxxx'); | |
$Messages = array('text1', 'text2', 'text3'); | |
@$SendDateTime = date("Y-m-d")."T".date("H:i:s"); | |
$Result = $mySmsIr->SendMessage($MobileNumbers, $Messages, $SendDateTime); | |
// SentMessageResponseByDate | |
$Shamsi_FromDate = '1397/02/1'; | |
$Shamsi_ToDate = '1397/02/31'; | |
$RowsPerPage = 10; | |
$RequestedPageNumber = 1; | |
$Result = $mySmsIr->SentMessageResponseByDate($Shamsi_FromDate, $Shamsi_ToDate, $RowsPerPage, $RequestedPageNumber); | |
// SentMessageResponseById | |
$id = "enter your sent message id..."; | |
$Result = $mySmsIr->SentMessageResponseById($id); | |
// UltraFastSend | |
$data = array( | |
"ParameterArray" => array( | |
array( | |
"Parameter" => "FirstVariable", | |
"ParameterValue" => "xxxx" | |
), | |
array( | |
"Parameter" => "SecondVariable", | |
"ParameterValue" => "xxxx" | |
), | |
array( | |
"Parameter" => "ThirdVariable", | |
"ParameterValue" => "xxxx" | |
) | |
), | |
"Mobile" => "091xxxxxxxx", | |
"TemplateId" => "26" | |
); | |
$Result = $mySmsIr->UltraFastSend($data); | |
// VerificationCode | |
$Code = "12345"; | |
$MobileNumber = "091xxxxxxxx"; | |
$Result = $mySmsIr->VerificationCode($Code, $MobileNumber); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment