Bulk SMS.ir - Restful Api V1.0



UserInfo


POSTGetToken

http://RestfulSms.com/api/Token
HEADERS

Content-Type
application/json
BODY

{
"UserApiKey": "APIKEY",
"SecretKey": "SECRETKEY"
}
                        
Example Request
GetToken
                                    
                                    
                                        
class SmsIR_GetToken {

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key
    * @return void
	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	public function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$SmsIR_GetToken = new SmsIR_GetToken($APIKey,$SecretKey);
	$GetToken = $SmsIR_GetToken->GetToken();
	var_dump($GetToken);

} catch (Exeption $e) {
	echo 'Error GetToken : '.$e->getMessage();
}

?>
                                
                                    
                                
Example Request
GetToken
                                    
                                    
                                        

در صورت استفاده از Visual Studio IDE

لطفا در Package Manager Console

قطعه کد زیر را بنویسید

Install-Package SmsIrRestful

را اجرا کنید تا بسته nuget وب سرویس Restful در VS شما نصب گردد

جهت استفاده از متدهای مختلف بایستی Token امنیتی داشته باشید

جهت دریافت توکن امنیتی بایستی از قطعه کد زیر استفاده کنید

SmsIrRestful.Token tk = new SmsIrRestful.Token();
string result = tk.GetToken(userApiKey,secretKey);
                                
                                    
                                

GETCredit

http://RestfulSms.com/api/credit
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
Example Request
Credit
                                    
                                    
                                        
class SmsIR_GetCredit {

	/**
	* gets API credit Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPIcreditUrl() {
		return "http://RestfulSms.com/api/credit";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* Get Credit.
	*
    * @return string Indicates the sent sms result
	*/
	public function GetCredit() {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){

			$url = $this->getAPIcreditUrl();
			$GetCredit = $this->execute($url, $token);

			$object = json_decode($GetCredit);

			if(is_object($object)){
				$array = get_object_vars($object);

				if(is_array($array)){
					if($array['IsSuccessful'] == true){
						$result = $array['Credit'];

					} else {
						$result = $array['Message'];
					}
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.

	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(

			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);

			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.

	*
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){


		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$SmsIR_GetCredit = new SmsIR_GetCredit($APIKey,$SecretKey);
	$GetCredit = $SmsIR_GetCredit->GetCredit();
	var_dump($GetCredit);

} catch (Exeption $e) {
	echo 'Error GetCredit : '.$e->getMessage();
}

?>


                                
                                    
                                
Example Request
Credit
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

CreditResponse credit = new Credit().GetCredit(token);

if (credit.IsSuccessful)
{
}
else
{
}

                                
                                    
                                

GETSMSLine

http://RestfulSms.com/api/SMSLine
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
Example Request
SMSLine
                                    
                                    
                                        
class SmsIR_GetSmsLines {

	/**
	* gets API SMS Line Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPISMSLineUrl() {
		return "http://RestfulSms.com/api/SMSLine";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }


	/**
	* Get Sms Lines.
	*
    * @return string Indicates the sent sms result
	*/
	public function GetSmsLines() {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){

			$url = $this->getAPISMSLineUrl();
			$GetSmsLines = $this->execute($url, $token);

			$object = json_decode($GetSmsLines);

			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){
					if($array['IsSuccessful'] == true){
						$result = $array['SMSLines'];
					} else {
						$result = $array['Message'];
					}
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);


		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;

				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$SmsIR_GetSmsLines = new SmsIR_GetSmsLines($APIKey,$SecretKey);
	$GetSmsLines = $SmsIR_GetSmsLines->GetSmsLines();
	var_dump($GetSmsLines);

} catch (Exeption $e) {
	echo 'Error GetSmsLines : '.$e->getMessage();
}

?>

                                
                                    
                                
Example Request
SMSLine
                                    
                                    
                                        

//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

SmsLineNumber credit = new SmsLine().GetSmsLines(token);

if (credit == null)
	throw new Exception($@"{nameof(credit) } is null");

if (credit.IsSuccessful)
{

}
else
{

}

                                
                                    
                                

Send-Receive


POSTMessageSend

http://RestfulSms.com/api/MessageSend
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
BODY

{
"Messages":["TEXT"],
"MobileNumbers": ["MOBILE"],
"LineNumber": "LINENUMBER",
"SendDateTime": "",
"CanContinueInCaseOfError": "false",
}
                        
Example Request
MessageSend
                                    
                                    
                                        
class SmsIR_SendMessage {

	/**
	* gets API Message Send Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPIMessageSendUrl() {
		return "http://RestfulSms.com/api/MessageSend";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* 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){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
		$this->LineNumber = $LineNumber;
    }

	/**
	* send sms.
	*
	* @param MobileNumbers[] $MobileNumbers array structure of mobile numbers
	* @param Messages[] $Messages array structure of messages
	* @param string $SendDateTime Send Date Time
    * @return string Indicates the sent sms result
	*/
	public function SendMessage($MobileNumbers, $Messages, $SendDateTime = '') {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){

			$postData = array(
				'Messages' => $Messages,
				'MobileNumbers' => $MobileNumbers,
				'LineNumber' => $this->LineNumber,
				'SendDateTime' => $SendDateTime,
				'CanContinueInCaseOfError' => 'false'
			);

			$url = $this->getAPIMessageSendUrl();
			$SendMessage = $this->execute($postData, $url, $token);
			$object = json_decode($SendMessage);
			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){
					$result = $array['Message'];
				} else {
					$result = false;

				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/

	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;

				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.

	*
	* @param postData[] $postData array of json data

	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($postData, $url, $token){

		$postString = json_encode($postData);

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(

											'Content-Type: application/json',
											'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);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {


	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";
	$LineNumber = "enter your line number ...";

	// your mobile numbers
	$MobileNumbers = array('091xxxxxxxx','092xxxxxxxx','093xxxxxxxx');

	// your text messages
	$Messages = array('text1','text2','text3');

	// sending date
	@$SendDateTime = date("Y-m-d")."T".date("H:i:s");

	$SmsIR_SendMessage = new SmsIR_SendMessage($APIKey,$SecretKey,$LineNumber);
	$SendMessage = $SmsIR_SendMessage->SendMessage($MobileNumbers,$Messages,$SendDateTime);
	var_dump($SendMessage);

} catch (Exeption $e) {
	echo 'Error SendMessage : '.$e->getMessage();
}

?>
                                
                                    
                                
Example Request
MessageSend
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

var messageSendObject = new MessageSendObject()
{
	Messages = new List <String> { "تست" }.ToArray(),
	MobileNumbers = new List <String> { "09120000001" }.ToArray(),
	LineNumber = "30003472012345",
	SendDateTime = null,
	CanContinueInCaseOfError = true
};

MessageSendResponseObject messageSendResponseObject = new MessageSend().Send(token, messageSendObject);

if (messageSendResponseObject.IsSuccessful)
{

}
else
{

}

                                
                                    
                                

GETMessageSend (ReportByDate)

http://RestfulSms.com/api/MessageSend?Shamsi_FromDate=[StartDate_SHAMSI]&Shamsi_ToDate=[EndDate_SHAMSI]&RowsPerPage=10&RequestedPageNumber=1
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
PARAMS

Shamsi_FromDate
[StartDate_SHAMSI]
Shamsi_ToDate
[EndDate_SHAMSI]
RowsPerPage
10
RequestedPageNumber
1
Example Request
MessageSend (ReportByDate)
                                    
                                    
                                        
class SmsIR_SentMessageResponseByDate {

	/**
	* gets API Message Send Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPIMessageSendUrl() {
		return "http://RestfulSms.com/api/MessageSend";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* 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 Indicates the sent sms result
	*/
	public function SentMessageResponseByDate($Shamsi_FromDate, $Shamsi_ToDate, $RowsPerPage, $RequestedPageNumber) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){

			$url = $this->getAPIMessageSendUrl()."?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)){
				$array = get_object_vars($object);
				if(is_array($array)){
					if($array['IsSuccessful'] == true){
						$result = $array['Messages'];
					} else {
						$result = $array['Message'];
					}
				} else {
					$result = false;
				}

			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$Shamsi_FromDate = '1397/02/1';
	$Shamsi_ToDate = '1397/02/31';
	$RowsPerPage = 10;
	$RequestedPageNumber = 1;

	$SmsIR_SentMessageResponseByDate = new SmsIR_SentMessageResponseByDate($APIKey,$SecretKey);
	$SentMessageResponseByDate = $SmsIR_SentMessageResponseByDate->SentMessageResponseByDate($Shamsi_FromDate, $Shamsi_ToDate, $RowsPerPage, $RequestedPageNumber);
	var_dump($SentMessageResponseByDate);

} catch (Exeption $e) {
	echo 'Error SentMessageResponseByDate : '.$e->getMessage();
}

?>
                                
                                    
                                
Example Request
MessageSend (ReportByDate)
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

var sentMessageResponseByDate = new MessageSend().GetByDate(token, "1396/04/01", "1396/04/31", 10, 1);

if (sentMessageResponseByDate.IsSuccessful)
{

}
else
{

}

                                        
                                    
                                

GETMessageSend (ReportById)

http://RestfulSms.com/api/MessageSend?id=[ID]
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
PARAMS

id
[ID]
Example Request
MessageSend (ReportById)
                                    
                                    
                                         
class SmsIR_SentMessageResponseById {

	/**
	* gets API Message Send Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPIMessageSendUrl() {
		return "http://RestfulSms.com/api/MessageSend";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* Sent Message Response By Id.
	*
	* @param string $id messages id
    * @return string Indicates the sent sms result
	*/
	public function SentMessageResponseById($id) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){

			$url = $this->getAPIMessageSendUrl()."?id=".$id;
			$SentMessageResponseById = $this->execute($url, $token);

			$object = json_decode($SentMessageResponseById);

			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){
					if($array['IsSuccessful'] == true){
						$result = $array['Messages'];

					} else {
						$result = $array['Message'];
					}
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.

	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(

			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);

			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.

	*
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){


		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	// your sent message id
	$id = "enter your message id ...";

	$SmsIR_SentMessageResponseById = new SmsIR_SentMessageResponseById($APIKey,$SecretKey);

	$SentMessageResponseById = $SmsIR_SentMessageResponseById->SentMessageResponseById($id);
	var_dump($SentMessageResponseById);

} catch (Exeption $e) {
	echo 'Error SentMessageResponseById : '.$e->getMessage();
}

?>
                                
                                    
                                
Example Request
MessageSend (ReportById)
                                    
                                    
                                         

//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

SentMessageResponseById messageSendResponseById = new MessageSend().GetById(token, 5643981);

if (messageSendResponseById.IsSuccessful)
{

}
else
{

}
                                
                                    
                                

GETMessageSend (ReportByBachkey)

http://restfulsms.com/api/MessageSend?pageId=[PageID]&batchKey=[BatchKey]
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
PARAMS

pageId
[PageID]
batchKey
[BatchKey]
Example Request
MessageSend (ReportByBachkey)
                                    
                                    
                                        
class SmsIR_ReceiveMessageByBatchKeyAndPageId {

	/**
	* gets API Message Receive Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPIMessageReceiveUrl() {
		return "http://RestfulSms.com/api/MessageSend";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* Gets Receive Message By BatchKey And PageId.
	*
	* @param string $pageId page id for getting messages
	* @param string $batchKey sent messages batchkey
    * @return string Indicates the sent sms result
	*/
	public function ReceiveMessageByBatchKeyAndPageId($pageId, $batchKey) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){


			$url = $this->getAPIMessageReceiveUrl()."?pageId=".$pageId."&batchKey=".$batchKey;
			$ReceiveMessageByBatchKeyAndPageId = $this->execute($url, $token);

			$object = json_decode($ReceiveMessageByBatchKeyAndPageId);

			if(is_object($object)){
				$array = get_object_vars($object);

				if(is_array($array)){
					if($array['IsSuccessful'] == true){
						$result = $array['Messages'];
					} else {
						$result = $array['Message'];
					}

				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);

		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){

				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.

	*
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result

	*/
	private function execute($url, $token){

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;

	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$batchKey = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
	$pageId = 1;

	$SmsIR_ReceiveMessageByBatchKeyAndPageId = new SmsIR_ReceiveMessageByBatchKeyAndPageId($APIKey,$SecretKey);
	$ReceiveMessageByBatchKeyAndPageId = $SmsIR_ReceiveMessageByBatchKeyAndPageId->ReceiveMessageByBatchKeyAndPageId($pageId, $batchKey);
	var_dump($ReceiveMessageByBatchKeyAndPageId);

} catch (Exeption $e) {
	echo 'Error ReceiveMessageByBatchKeyAndPageId : '.$e->getMessage();
}

?>                                   
                                    
                                
Example Request
MessageSend (ReportByBachkey)
                                    
                                    
                                        
                                            coming Soon
                                        
                                    
                                

GETReceiveMessage (ByLastID)

http://RestfulSms.com/api/ReceiveMessage?id=[ID]
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
PARAMS

id
[ID]
Example Request
ReceiveMessage (ByLastID)
                                    
                                    
                                        
class SmsIR_ReceiveMessageByLastId {

	/**
	* gets API Message Receive Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPIMessageReceiveUrl() {
		return "http://RestfulSms.com/api/ReceiveMessage";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* Receive Message By Last Id.
	*
	* @param string $id messages id
    * @return string Indicates the sent sms result
	*/
	public function ReceiveMessageByLastId($id) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){

			$url = $this->getAPIMessageReceiveUrl()."?id=".$id;
			$ReceiveMessageByLastId = $this->execute($url, $token);


			$object = json_decode($ReceiveMessageByLastId);

			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){
					if($array['IsSuccessful'] == true){
						$result = $array['Messages'];

					} else {
						$result = $array['Message'];
					}
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.

	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(

			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);

			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.

	*
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){


		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	// your received message id
	$id = 1;

	$SmsIR_ReceiveMessageByLastId = new SmsIR_ReceiveMessageByLastId($APIKey,$SecretKey);
	$ReceiveMessageByLastId = $SmsIR_ReceiveMessageByLastId->ReceiveMessageByLastId($id);
	var_dump($ReceiveMessageByLastId);

} catch (Exeption $e) {
	echo 'Error ReceiveMessageByLastId : '.$e->getMessage();
}

?>                                   
                                    
                                
Example Request
ReceiveMessage (ByLastID)
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

var messageSendResponseById = new ReceiveMessage().GetByLastMessageID(token, 5643981);

if (messageSendResponseById.IsSuccessful)
{

}
else
{

}
                                        
                                    
                                

GETReceiveMessage (ByDate)

http://RestfulSms.com/api/ReceiveMessage?Shamsi_FromDate=[StartDate_SHAMSI]&Shamsi_ToDate=[EndDate_SHAMSI]&RowsPerPage=10&RequestedPageNumber=1
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
PARAMS

Shamsi_FromDate
[StartDate_SHAMSI]
Shamsi_ToDate
[EndDate_SHAMSI]
RowsPerPage
10
RequestedPageNumber
1
Example Request
ReceiveMessage (ByDate)
                                        
                                        
                                            
   class SmsIR_ReceiveMessageResponseByDate {

	/**
	* gets API Message Receive Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPIMessageReceiveUrl() {
		return "http://RestfulSms.com/api/ReceiveMessage";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* 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 Indicates the sent sms result

	*/
	public function ReceiveMessageResponseByDate($Shamsi_FromDate, $Shamsi_ToDate, $RowsPerPage, $RequestedPageNumber) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){

			$url = $this->getAPIMessageReceiveUrl()."?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)){
				$array = get_object_vars($object);
				if(is_array($array)){
					if($array['IsSuccessful'] == true){
						$result = $array['Messages'];
					} else {
						$result = $array['Message'];
					}
				} else {
					$result = false;
				}

			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$Shamsi_FromDate = '1397/02/1';
	$Shamsi_ToDate = '1397/02/31';
	$RowsPerPage = 10;
	$RequestedPageNumber = 1;

	$SmsIR_ReceiveMessageResponseByDate = new SmsIR_ReceiveMessageResponseByDate($APIKey,$SecretKey);
	$ReceiveMessageResponseByDate = $SmsIR_ReceiveMessageResponseByDate->ReceiveMessageResponseByDate($Shamsi_FromDate, $Shamsi_ToDate, $RowsPerPage, $RequestedPageNumber);
	var_dump($ReceiveMessageResponseByDate);

} catch (Exeption $e) {
	echo 'Error ReceiveMessageResponseByDate : '.$e->getMessage();
}

?>
                                        
                                        
                                    
Example Request
ReceiveMessage (ByDate)
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

var receivedMessageResponseByDate = new ReceiveMessage().GetByDate(token, "1396/04/01", "1396/04/31", 10, 1);

if (receivedMessageResponseByDate.IsSuccessful)
{

}
else
{

}                                     
                                    
                                

CustomerClub

POSTCustomerClubContact (AddContact)

http://restfulsms.com/api/CustomerClubContact
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
BODY

{
"Prefix":"PREFIX",
"FirstName": "FIRSTNAME",
"LastName": "LASTNAME",
"Mobile": "MOBILE",
"BirthDay": "",
"CategoryId": "CATEGORYID"
}
                        
Example Request
CustomerClubContact (AddContact)
                                    
                                    
                                        
class SmsIR_AddContactToCustomerClub {

	/**
	* gets API Customer Club Contact Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPICustomerClubContactUrl() {
		return "http://RestfulSms.com/api/CustomerClubContact";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* 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 Indicates the sent sms result
	*/
	public function AddContactToCustomerClub($Prefix, $FirstName, $LastName, $Mobile, $BirthDay, $CategoryId) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){
			$postData = array(
				'Prefix' => $Prefix,
				'FirstName' => $FirstName,
				'LastName' => $LastName,
				'Mobile' => $Mobile,
				'BirthDay' => $BirthDay,
				'CategoryId' => $CategoryId
			);

			$url = $this->getAPICustomerClubContactUrl();
			$AddContactToCustomerClub = $this->execute($postData, $url, $token);
			$object = json_decode($AddContactToCustomerClub);

			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){
					$result = $array['Message'];
				} else {

					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param postData[] $postData array of json data
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($postData, $url, $token){

		$postString = json_encode($postData);

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {


	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	// contact information
	$Prefix = 'Mr';
	$FirstName = 'FirstName';
	$LastName = 'LastName';
	$Mobile = '091xxxxxxxx';
	$BirthDay = '1370/01/01';
	$CategoryId = '';

	$SmsIR_AddContactToCustomerClub = new SmsIR_AddContactToCustomerClub($APIKey,$SecretKey);
	$AddContactToCustomerClub = $SmsIR_AddContactToCustomerClub->AddContactToCustomerClub($Prefix, $FirstName, $LastName, $Mobile, $BirthDay, $CategoryId);
	var_dump($AddContactToCustomerClub);

} catch (Exeption $e) {
	echo 'Error AddContactToCustomerClub : '.$e->getMessage();
}
?>
                                    
                                    
                                
Example Request
CustomerClubContact (AddContact)
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

var customerClubContactObject = new CustomerClubContactObject()
{
	Prefix = "آقای",
	FirstName = "یونس ",
	LastName = "بقائی مقدم",
	Mobile = "09120000001",
	BirthDay = null,
	CategoryId = 44
};

var customerClubContactResponse = new CustomerClubContact().Create(token, customerClubContactObject);

if (customerClubContactResponse.IsSuccessful)
{

}
else
{

}
                                    
                                    
                                

PUTCustomerClubContact (UpdateContact)

http://restfulsms.com/api/CustomerClubContact
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
BODY

{
  "Prefix":"PREFIX",
  "FirstName": "FIRSTNAME",
  "LastName": "LASTNAME",
  "Mobile": "MOBILE",
  "BirthDay": "",
  "CategoryId": ""
}
                            
Example Request
CustomerClubContact (UpdateContact)
                                    
                                    
                                        
class SmsIR_EditCustomerClubContact {

	/**
	* gets API Customer Club Contact Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPICustomerClubContactUrl() {
		return "http://RestfulSms.com/api/CustomerClubContact";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* 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 Indicates the sent sms result
	*/
	public function EditCustomerClubContact($Prefix, $FirstName, $LastName, $Mobile, $BirthDay, $CategoryId) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){
			$postData = array(
				'Prefix' => $Prefix,
				'FirstName' => $FirstName,
				'LastName' => $LastName,
				'Mobile' => $Mobile,
				'BirthDay' => $BirthDay,
				'CategoryId' => $CategoryId
			);

			$url = $this->getAPICustomerClubContactUrl();
			$EditCustomerClubContact = $this->execute($postData, $url, $token);
			$object = json_decode($EditCustomerClubContact);

			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){
					$result = $array['Message'];
				} else {

					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param postData[] $postData array of json data
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($postData, $url, $token){

		$postString = json_encode($postData);

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'x-sms-ir-secure-token: '.$token
											));
		curl_setopt($ch, CURLOPT_HEADER, false);

		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	// contact information
	$Prefix = 'Mr';
	$FirstName = 'FirstName';
	$LastName = 'LastName';
	$Mobile = '091xxxxxxxx';
	$BirthDay = '1370/01/01';
	$CategoryId = '';

	$SmsIR_EditCustomerClubContact = new SmsIR_EditCustomerClubContact($APIKey,$SecretKey);
	$EditCustomerClubContact = $SmsIR_EditCustomerClubContact->EditCustomerClubContact($Prefix, $FirstName, $LastName, $Mobile, $BirthDay, $CategoryId);
	var_dump($EditCustomerClubContact);

} catch (Exeption $e) {
	echo 'Error EditCustomerClubContact : '.$e->getMessage();
}

?>
                                    
                                    
                                
Example Request
CustomerClubContact (UpdateContact)
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

 var customerClubContactObject = new CustomerClubContactObject()
{
	Prefix = "آقای",
	FirstName = "یونس ",
	LastName = "بقائی مقدم",
	Mobile = "09120000001",
	BirthDay = null,
	CategoryId = 44
};


var customerClubContactResponse = new CustomerClubContact().Update(token, customerClubContactObject);

if (customerClubContactResponse.IsSuccessful)
{

}
else
{

}
                                    
                                    
                                

GETCustomerClubContact (GetCategories)

http://restfulsms.com/api/CustomerClubContact/GetCategories
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
Example Request
CustomerClubContact (GetCategories)
                                    
                                    
class SmsIR_GetCustomerClubCategories {

	/**
	* gets API Customer Club Contact Categories Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPICustomerClubContactCategoriesUrl() {
		return "http://RestfulSms.com/api/CustomerClubContact/GetCategories";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**

	* Get Customer Club Categories.
	*
    * @return string Indicates the contact categories result
	*/
	public function GetCustomerClubCategories() {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){

			$url = $this->getAPICustomerClubContactCategoriesUrl();
			$GetCustomerClubCategories = $this->execute($url, $token);
			$object = json_decode($GetCustomerClubCategories);

			if(is_object($object)){
				$array = get_object_vars($object);

				if(is_array($array)){
					$result = $array['ContactsCustomerClubCategories'];
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));

		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param string $url url

	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){

		$ch = curl_init($url);

		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}


try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$SmsIR_GetCustomerClubCategories = new SmsIR_GetCustomerClubCategories($APIKey,$SecretKey);
	$GetCustomerClubCategories = $SmsIR_GetCustomerClubCategories->GetCustomerClubCategories();
	var_dump($GetCustomerClubCategories);

} catch (Exeption $e) {
	echo 'Error GetCustomerClubCategories : '.$e->getMessage();
}

?>
                                    
                                
Example Request
CustomerClubContact (GetCategories)
                                    
                                    
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

            var token = new Token().GetToken("userApikey", "secretKey");

            var customerClubContactCategoryResponse = new CustomerClubContact().GetCategories(token);

            if (customerClubContactCategoryResponse == null)
                throw new Exception($@"{nameof(customerClubContactCategoryResponse) } is null");

            if (customerClubContactCategoryResponse.IsSuccessful)
            {

            }
            else
            {

            }
                                    
                                

GETCustomerClubContact (GetContactsByCategory&ById)

restfulsms.com/api/CustomerClubContact/GetContactsByCategoryById?categoryId=[ID]&pageNumber=1
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
PARAMS

categoryId
[ID]
pageNumber
1
Example Request
CustomerClubContact (GetContactsByCategory&ById)
                                    
                                        
                                             
class SmsIR_GetCustomerClubContactsByCategoryIdByPageId {

	/**
	* gets API Customer Club Contact Categories Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPICustomerClubContactCategoriesUrl() {
		return "http://RestfulSms.com/api/CustomerClubContact/GetContactsByCategoryById";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**

	* 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 != false){

			$url = $this->getAPICustomerClubContactCategoriesUrl()."?categoryId=".$categoryId."&pageNumber=".$pageId;
			$GetCustomerClubContactsByCategoryIdByPageId = $this->execute($url, $token);
			$object = json_decode($GetCustomerClubContactsByCategoryIdByPageId);

			if(is_object($object)){
				$array = get_object_vars($object);

				if(is_array($array)){

					$result = $array['ContactsCustomerClubResponseDetails'];
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));

		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param string $url url

	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){

		$ch = curl_init($url);

		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}


try {

	date_default_timezone_set("Asia/Tehran");


	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$categoryId = 0;
	$pageId = 1;

	$SmsIR_GetCustomerClubContactsByCategoryIdByPageId = new SmsIR_GetCustomerClubContactsByCategoryIdByPageId($APIKey,$SecretKey);
	$GetCustomerClubContactsByCategoryIdByPageId = $SmsIR_GetCustomerClubContactsByCategoryIdByPageId->GetCustomerClubContactsByCategoryIdByPageId($categoryId,$pageId);
	var_dump($GetCustomerClubContactsByCategoryIdByPageId);

} catch (Exeption $e) {
	echo 'Error GetCustomerClubContactsByCategoryIdByPageId : '.$e->getMessage();
}

?>

                                    
                                        
                                
Example Request
CustomerClubContact (GetContactsByCategory&ById)
                                    
                                    
                                         
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

            var token = new Token().GetToken("userApikey", "secretKey");

            var customerClubContactResponse = new CustomerClubContact().GetContactsByCategoryId(token, 44, 1);

            if (customerClubContactResponse == null)
                throw new Exception($@"{nameof(customerClubContactResponse) } is null");

            if (customerClubContactResponse.IsSuccessful)
            {

            }
            else
            {

            }
                                
                                    
                                

GETCustomerClubContact (GetAllContactsByPageID)

http://restfulsms.com/api/CustomerClubContact/GetContacts?pageNumber=1
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
PARAMS

pageNumber
1
Example Request
CustomerClubContact (GetAllContactsByPageID)
                                    
                                    
                                        
class SmsIR_GetCustomerClubContactsByPageId {

	/**
	* gets API Customer Club Contact Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPICustomerClubContactUrl() {
		return "http://RestfulSms.com/api/CustomerClubContact/GetContacts";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* Get Customer Club contacts.
	*
    * @return string Indicates the contact result
	*/
	public function GetCustomerClubContactsByPageId($pageId) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){

			$url = $this->getAPICustomerClubContactUrl()."?pageNumber=".$pageId;
			$GetCustomerClubContactsByPageId = $this->execute($url, $token);
			$object = json_decode($GetCustomerClubContactsByPageId);

			if(is_object($object)){
				$array = get_object_vars($object);

				if(is_array($array)){

					$result = $array['ContactsCustomerClubResponseDetails'];
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));

		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param string $url url

	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){

		$ch = curl_init($url);

		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}


try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$pageId = 1;

	$SmsIR_GetCustomerClubContactsByPageId = new SmsIR_GetCustomerClubContactsByPageId($APIKey,$SecretKey);
	$GetCustomerClubContactsByPageId = $SmsIR_GetCustomerClubContactsByPageId->GetCustomerClubContactsByPageId($pageId);
	var_dump($GetCustomerClubContactsByPageId);

} catch (Exeption $e) {
	echo 'Error GetCustomerClubContactsByPageId : '.$e->getMessage();
}

?> response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                    
                                    
                                
Example Request
CustomerClubContact (GetAllContactsByPageID)
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

            var token = new Token().GetToken("userApikey", "secretKey");

            var customerClubContactResponse = new CustomerClubContact().GetContacts(token, 1);

            if (customerClubContactResponse == null)
                throw new Exception($@"{nameof(customerClubContactResponse) } is null");

            if (customerClubContactResponse.IsSuccessful)
            {

            }
            else
            {

            }
                                    
                                    
                                

POSTCustomerClub (Send)

http://RestfulSms.com/api/CustomerClub/Send
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
BODY

{
  "Messages": [ "TEXT1", "TEXT2", "TEXT3" ],
  "MobileNumbers": ["MOBILE1" , "MOBILE2", "MOBILE3"],
  "SendDateTime":"",
  "CanContinueInCaseOfError":"true"
}
                            
Example Request
CustomerClub (Send)
                                    
                                    
                                        
class SmsIR_CustomerClubSend {

	/**
	* gets API Customer Club Send Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPICustomerClubSendUrl() {
		return "http://RestfulSms.com/api/CustomerClub/Send";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* 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 Indicates the sent sms result
	*/
	public function CustomerClubSend($MobileNumbers, $Messages, $SendDateTime = '') {


		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){
			$postData = array(
				'Messages' => $Messages,
				'MobileNumbers' => $MobileNumbers,
				'SendDateTime' => $SendDateTime,
				'CanContinueInCaseOfError' => 'false'
			);

			$url = $this->getAPICustomerClubSendUrl();
			$CustomerClubSend = $this->execute($postData, $url, $token);
			$object = json_decode($CustomerClubSend);

			if(is_object($object)){
				$array = get_object_vars($object);

				if(is_array($array)){

					$result = $array['Message'];
				} else {
					$result = false;
				}

			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}


	/**
	* executes the main method.
	*
	* @param postData[] $postData array of json data
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($postData, $url, $token){

		$postString = json_encode($postData);

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";

	$SecretKey = "enter your secret key ...";

	// your mobile numbers
	$MobileNumbers = array('091xxxxxxxx','092xxxxxxxx','093xxxxxxxx');


	// your text messages
	$Messages = array('text1','text2','text3');

	// sending date
	@$SendDateTime = date("Y-m-d")."T".date("H:i:s");

	$SmsIR_CustomerClubSend = new SmsIR_CustomerClubSend($APIKey,$SecretKey);
	$CustomerClubSend = $SmsIR_CustomerClubSend->CustomerClubSend($MobileNumbers,$Messages,$SendDateTime);
	var_dump($CustomerClubSend);

} catch (Exeption $e) {
	echo 'Error CustomerClubSend : '.$e->getMessage();
}

?>
                                    
                                    
                                
Example Request
CustomerClub (Send)
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

var customerClubSend = new CustomerClubSend()
{
	Messages = new List<string>() { "تست باشگاه" }.ToArray(),
	MobileNumbers = new List<string>() { "09120000001" }.ToArray(),
	SendDateTime = null,
	CanContinueInCaseOfError = false
};

var customerClubContactResponse = new CustomerClub().Send(token, customerClubSend);

if (customerClubContactResponse.IsSuccessful)
{

}
else
{

}
                                    
                                    
                                

POSTCustomerClub (AddContact&Send)

http://RestfulSms.com/api/CustomerClub/AddContactAndSend
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
BODY

[{
       "Prefix": "PREFIX",
       "FirstName": "FIRSTNAME" ,
       "LastName":"LASTNAME",
       "Mobile":"MOBILE",
       "BirthDay":"",
       "CategoryId":"CATEGORYID",
       "MessageText":"TEXT"
    }]
                            
Example Request
CustomerClub (AddContact&Send)
                                    
                                    
                                        

class SmsIR_CustomerClubInsertAndSendMessage {

	/**
	* gets API Customer Club Add Contact And Send Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPICustomerClubAddAndSendUrl() {
		return "http://RestfulSms.com/api/CustomerClub/AddContactAndSend";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* Customer Club Insert And Send Message.
	*
	* @param data[] $data array structure of contacts data
    * @return string Indicates the sent sms result
	*/
	public function CustomerClubInsertAndSendMessage($data) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){
			$postData = $data;

			$url = $this->getAPICustomerClubAddAndSendUrl();
			$CustomerClubInsertAndSendMessage = $this->execute($postData, $url, $token);
			$object = json_decode($CustomerClubInsertAndSendMessage);

			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){
					$result = $array['Message'];
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*

    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(

			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'

                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);


		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);

			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}


		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param postData[] $postData array of json data
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($postData, $url, $token){

		$postString = json_encode($postData);

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	// contacts information
	$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"
		)
	);

	$SmsIR_CustomerClubInsertAndSendMessage = new SmsIR_CustomerClubInsertAndSendMessage($APIKey,$SecretKey);
	$CustomerClubInsertAndSendMessage = $SmsIR_CustomerClubInsertAndSendMessage->CustomerClubInsertAndSendMessage($data);
	var_dump($CustomerClubInsertAndSendMessage);

} catch (Exeption $e) {
	echo 'Error CustomerClubInsertAndSendMessage : '.$e->getMessage();
}
?>
                                    
                                    
                                
Example Request
CustomerClub (AddContact&Send)
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

var customerClubInsertAndSendMessageList = new List<CustomerClubInsertAndSendMessage>();

customerClubInsertAndSendMessageList.Add(
new CustomerClubInsertAndSendMessage()
{
	Prefix = "آقای",
	FirstName = "یونس ",
	LastName = "بقائی مقدم",
	Mobile = "09120000001",
	BirthDay = null,
	CategoryId = 44,
	MessageText = " ثبت مشتری و ارسال"
});

var customerClubContactResponse = new CustomerClub().AddContactAndSend(token, customerClubInsertAndSendMessageList.ToArray());

if (customerClubContactResponse.IsSuccessful)
{

}
else
{

}
                                    
                                    
                                

POSTCustomerClub (SendToCategories)

http://RestfulSms.com/api/CustomerClub/SendToCategories
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
BODY

{
       "Messages": "TEXT",
       "contactsCustomerClubCategoryIds": [CategoryID1,CategoryID2] ,
       "SendDateTime":"",
       "CanContinueInCaseOfError":"false"
}
                            
Example Request
CustomerClub (SendToCategories)
                                    
                                    
                                        
class SmsIR_CustomerClubSendToCategories {

	/**
	* gets API Customer Club Send To Categories Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPICustomerClubSendToCategoriesUrl() {
		return "http://RestfulSms.com/api/CustomerClub/SendToCategories";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* 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 Indicates the sent sms result
	*/
	public function CustomerClubSendToCategories($Messages, $contactsCustomerClubCategoryIds, $SendDateTime = '') {


		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){
			$postData = array(
				'Messages' => $Messages,
				'contactsCustomerClubCategoryIds' => $contactsCustomerClubCategoryIds,
				'SendDateTime' => $SendDateTime,
				'CanContinueInCaseOfError' => 'false'
			);

			$url = $this->getAPICustomerClubSendToCategoriesUrl();
			$CustomerClubSendToCategories = $this->execute($postData, $url, $token);
			$object = json_decode($CustomerClubSendToCategories);

			if(is_object($object)){
				$array = get_object_vars($object);

				if(is_array($array)){

					$result = $array['Message'];
				} else {
					$result = false;
				}

			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}


	/**
	* executes the main method.
	*
	* @param postData[] $postData array of json data
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($postData, $url, $token){

		$postString = json_encode($postData);

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");


	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	// your text message
	$Messages = 'text';

	// your Customer Club contacts Category Ids. if it does`nt have any value then sends to all customer club contacts.
	$contactsCustomerClubCategoryIds = array(1,2); //for send to all -> array();

	// sending date
	@$SendDateTime = date("Y-m-d")."T".date("H:i:s");

	$SmsIR_CustomerClubSendToCategories = new SmsIR_CustomerClubSendToCategories($APIKey,$SecretKey);
	$CustomerClubSendToCategories = $SmsIR_CustomerClubSendToCategories->CustomerClubSendToCategories($Messages, $contactsCustomerClubCategoryIds, $SendDateTime);
	var_dump($CustomerClubSendToCategories);

} catch (Exeption $e) {
	echo 'Error CustomerClubSendToCategories : '.$e->getMessage();
}
?>
                                    
                                    
                                
Example Request
CustomerClub (SendToCategories)
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

var customerClubSendToCategories = new CustomerClubSendToCategories()
{
	Messages = "ارسال به گروه باشگاه",
	contactsCustomerClubCategoryIds = new List<int>() { 44}.ToArray(),
	SendDateTime = null,
	CanContinueInCaseOfError = false
};

CustomerClubSendResponse customerClubContactResponse = new CustomerClub().SendToCategories(token, customerClubSendToCategories);

if (customerClubContactResponse.IsSuccessful)
{

}
else
{

}
                                    
                                    
                                

GETCustomerClub (GetSendMessagesByPagination)

http://restfulsms.com/api/CustomerClub/GetSendMessagesByPagination?pageIndex=1&rowCount=10
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
PARAMS

pageIndex
1
rowCount
10
Example Request
CustomerClub (GetSendMessagesByPagination)
                                    
                                    
                                        
class SmsIR_GetCustomerClubSentMessagesByPageId {

	/**
	* gets API Customer Club Sent Messages Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPICustomerClubSentMessagesUrl() {
		return "http://RestfulSms.com/api/CustomerClub/GetSendMessagesByPagination";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* 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 != false){

			$url = $this->getAPICustomerClubSentMessagesUrl()."?pageIndex=".$pageId."&rowCount=".$rowCount;
			$GetCustomerClubSentMessagesByPageId = $this->execute($url, $token);
			$object = json_decode($GetCustomerClubSentMessagesByPageId);

			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){
					$result = $array['ContactsCustomerClubResponseDetails'];
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}


	/**
	* gets token key for all web service requests.
	*

    * @return string Indicates the token key
	*/
	private function GetToken(){

		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);


		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);


		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];

				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}


	/**
	* executes the main method.
	*
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$pageId = 1;
	$rowCount = 10;

	$SmsIR_GetCustomerClubSentMessagesByPageId = new SmsIR_GetCustomerClubSentMessagesByPageId($APIKey,$SecretKey);
	$GetCustomerClubSentMessagesByPageId = $SmsIR_GetCustomerClubSentMessagesByPageId->GetCustomerClubSentMessagesByPageId($pageId,$rowCount);
	var_dump($GetCustomerClubSentMessagesByPageId);

} catch (Exeption $e) {
	echo 'Error GetCustomerClubSentMessagesByPageId : '.$e->getMessage();
}

?>
                                    
                                    
                                
Example Request
CustomerClub (GetSendMessagesByPagination)
                                    
                                    
                                        
                                              coming soon
                                        
                                    
                                

GETCustomerClub (GetSendMessagesByPaginationAndLastId)

http://restfulsms.com/api/CustomerClub/GetSendMessagesByPaginationAndLastId?lastId=[ID]
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
PARAMS

lastId
[ID]
Example Request
CustomerClub (GetSendMessagesByPaginationAndLastId)
                                    
                                    
                                        
class SmsIR_GetCustomerClubSentMessagesByLastId {

	/**
	* gets API Customer Club Sent Messages Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPICustomerClubSentMessagesUrl() {
		return "http://RestfulSms.com/api/CustomerClub/GetSendMessagesByPaginationAndLastId";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }

	/**
	* 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 != false){

			$url = $this->getAPICustomerClubSentMessagesUrl()."?lastId=".$lastId;
			$GetCustomerClubSentMessagesByLastId = $this->execute($url, $token);
			$object = json_decode($GetCustomerClubSentMessagesByLastId);

			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){

					$result = $array['ContactsCustomerClubResponseDetails'];
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(
			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));

		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);
			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param string $url url

	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($url, $token){

		$ch = curl_init($url);

		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}


try {

	date_default_timezone_set("Asia/Tehran");

	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	$lastId = 1;

	$SmsIR_GetCustomerClubSentMessagesByLastId = new SmsIR_GetCustomerClubSentMessagesByLastId($APIKey,$SecretKey);
	$GetCustomerClubSentMessagesByLastId = $SmsIR_GetCustomerClubSentMessagesByLastId->GetCustomerClubSentMessagesByLastId($lastId);
	var_dump($GetCustomerClubSentMessagesByLastId);

} catch (Exeption $e) {
	echo 'Error GetCustomerClubSentMessagesByLastId : '.$e->getMessage();
}

?>
                                    
                                    
                                
Example Request
CustomerClub (GetSendMessagesByPaginationAndLastId)
                                    
                                    
                                        
                                            coming soon
                                        
                                    
                                

POSTCustomerClub (DeleteContactCustomerClub)

http://restfulsms.com/api/CustomerClub/DeleteContactCustomerClub
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[TOKEN]
BODY

{
    "Mobile" : "MOBILE",
    "CanContinueInCaseOfError" : false
}
                            
Example Request
CustomerClub (DeleteContactCustomerClub)
                                    
                                     
                                         
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://restfulsms.com/api/CustomerClub/DeleteContactCustomerClub",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"Mobile\" : \"MOBILE\",\n\t\"CanContinueInCaseOfError\" : false\n}",
  CURLOPT_HTTPHEADER => array(
    "Cache-Control: no-cache",
    "Content-Type: application/json",
    "Postman-Token: 1857c03e-fe82-4cb7-a9a2-4df5635ba19f",
    "x-sms-ir-secure-token: [TOKEN]"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
                                                 
                                     
                                
Example Request
CustomerClub (DeleteContactCustomerClub)
                                    
                                     
                                         
                                            coming soon
                                         
                                     
                                

Verification


POSTVerificationCode

http://RestfulSms.com/api/VerificationCode
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
BODY

{
"Code": "CODE",
"MobileNumber": "MOBILE"
}
                        
Example Request
VerificationCode
                                    
                                    
                                        
class SmsIR_VerificationCode {

	/**
	* gets API Verification Code Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPIVerificationCodeUrl() {
		return "http://RestfulSms.com/api/VerificationCode";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }


	/**
	* Verification Code.
	*
	* @param string $Code Code
	* @param string $MobileNumber Mobile Number
    * @return string Indicates the sent sms result
	*/
	public function VerificationCode($Code, $MobileNumber) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){
			$postData = array(
				'Code' => $Code,
				'MobileNumber' => $MobileNumber,
			);

			$url = $this->getAPIVerificationCodeUrl();
			$VerificationCode = $this->execute($postData, $url, $token);
			$object = json_decode($VerificationCode);

			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){
					$result = $array['Message'];
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.

	*
    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(

			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'
                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);

			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}

		return $resp;
	}


	/**
	* executes the main method.
	*
	* @param postData[] $postData array of json data
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($postData, $url, $token){

		$postString = json_encode($postData);

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);

		curl_close($ch);


		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");


	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";

	// your code
	$Code = "12345";

	// your mobile number
	$MobileNumber = "091xxxxxxxx";

	$SmsIR_VerificationCode = new SmsIR_VerificationCode($APIKey,$SecretKey);
	$VerificationCode = $SmsIR_VerificationCode->VerificationCode($Code, $MobileNumber);
	var_dump($VerificationCode);

} catch (Exeption $e) {
	echo 'Error VerificationCode : '.$e->getMessage();
}

?>                                     
                                    
                                
Example Request
VerificationCode
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

var restVerificationCode = new RestVerificationCode()
{
	Code = "1234567890",
	MobileNumber = "09120000001"
};

var restVerificationCodeRespone = new VerificationCode().Send(token, restVerificationCode);

if (restVerificationCodeRespone.IsSuccessful)
{

}
else
{

}
                                    
                                    
                                

POSTUltraFastSend

http://RestfulSms.com/api/UltraFastSend
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
BODY

{
"ParameterArray":[
{ "Parameter": "Parameters1","ParameterValue": "Value1"},
{ "Parameter": "Parameters2","ParameterValue": "Value2"}
],
"Mobile":"MOBILE",
"TemplateId":"TemplateID"
}
                        
Example Request
UltraFastSend
                                    
                                    
                                        
class SmsIR_UltraFastSend {

	/**
	* gets API Ultra Fast Send Url.
	*
    * @return string Indicates the Url

	*/
	protected function getAPIUltraFastSendUrl() {
		return "http://RestfulSms.com/api/UltraFastSend";
	}

	/**
	* gets Api Token Url.
	*
    * @return string Indicates the Url

	*/
	protected function getApiTokenUrl(){
		return "http://RestfulSms.com/api/Token";
	}

	/**
	* gets config parameters for sending request.
	*
	* @param string $APIKey API Key
	* @param string $SecretKey Secret Key

    * @return void

	*/
    public function __construct($APIKey,$SecretKey){
		$this->APIKey = $APIKey;
		$this->SecretKey = $SecretKey;
    }


	/**
	* Ultra Fast Send Message.
	*
	* @param data[] $data array structure of message data
    * @return string Indicates the sent sms result
	*/
	public function UltraFastSend($data) {

		$token = $this->GetToken($this->APIKey, $this->SecretKey);
		if($token != false){
			$postData = $data;

			$url = $this->getAPIUltraFastSendUrl();
			$UltraFastSend = $this->execute($postData, $url, $token);
			$object = json_decode($UltraFastSend);

			if(is_object($object)){
				$array = get_object_vars($object);
				if(is_array($array)){
					$result = $array['Message'];
				} else {
					$result = false;
				}
			} else {
				$result = false;
			}

		} else {
			$result = false;
		}
		return $result;
	}

	/**
	* gets token key for all web service requests.
	*

    * @return string Indicates the token key
	*/
	private function GetToken(){
		$postData = array(

			'UserApiKey' => $this->APIKey,
			'SecretKey' => $this->SecretKey,
			'System' => 'php_rest_v_1_2'
		);
		$postString = json_encode($postData);

		$ch = curl_init($this->getApiTokenUrl());
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                            'Content-Type: application/json'

                                            ));
		curl_setopt($ch, CURLOPT_HEADER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);


		$result = curl_exec($ch);
		curl_close($ch);

		$response = json_decode($result);

		if(is_object($response)){
			$resultVars = get_object_vars($response);

			if(is_array($resultVars)){
				@$IsSuccessful = $resultVars['IsSuccessful'];
				if($IsSuccessful == true){
					@$TokenKey = $resultVars['TokenKey'];
					$resp = $TokenKey;
				} else {
					$resp = false;
				}
			}
		}


		return $resp;
	}

	/**
	* executes the main method.
	*
	* @param postData[] $postData array of json data
	* @param string $url url
	* @param string $token token string
    * @return string Indicates the curl execute result
	*/
	private function execute($postData, $url, $token){

		$postString = json_encode($postData);

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
											'Content-Type: application/json',
											'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);
		curl_setopt($ch, CURLOPT_POST, count($postString));
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);

		$result = curl_exec($ch);
		curl_close($ch);

		return $result;
	}
}

try {

	date_default_timezone_set("Asia/Tehran");


	// your sms.ir panel configuration
	$APIKey = "enter your api key ...";
	$SecretKey = "enter your secret key ...";


	// message data

	$data = array(
		"ParameterArray" => array(
			array(

				"Parameter" => "FirstVariable",
				"ParameterValue" => "xxxx"
			),
			array(
				"Parameter" => "SecondVariable",
				"ParameterValue" => "xxxx"
			),
			array(
				"Parameter" => "ThirdVariable",
				"ParameterValue" => "xxxx"
			)
		),
		"Mobile" => "091xxxxxxxx",
		"TemplateId" => "26"
	);

	$SmsIR_UltraFastSend = new SmsIR_UltraFastSend($APIKey,$SecretKey);
	$UltraFastSend = $SmsIR_UltraFastSend->UltraFastSend($data);
	var_dump($UltraFastSend);

} catch (Exeption $e) {
	echo 'Error UltraFastSend : '.$e->getMessage();
}

?>
                                    
                                    
                                
Example Request
UltraFastSend
                                    
                                    
                                        
//install nuget package https://www.nuget.org/packages/SmsIrRestful/

var token = new Token().GetToken("userApikey", "secretKey");

var ultraFastSend = new UltraFastSend()
{
	Mobile = 09120000001,
	TemplateId = 26,
	ParameterArray = new List <UltraFastParameters>()
	{
		new UltraFastParameters()
		{
			Parameter = "VerificationCode" , ParameterValue = "123321"
		}
	}.ToArray()

};

UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(token, ultraFastSend);

if (ultraFastSendRespone.IsSuccessful)
{

}
else
{

}
                                    
                                    
                                

POSTMessageReport

https://RestfulSms.com/api/MessageReport
HEADERS

Content-Type
application/json
x-sms-ir-secure-token
[YOURTOKEN]
BODY

{
"ReportType": "1",
"SentReturnId": "null",
"FromDate":"",
"ToDate":""
}
                        
Example Request
MessageReport
                                    
                                    
                                        
                                        
                                    
                                
Example Request
MessageReport
                                    
                                    
                                        
                                            //install nuget package https://www.nuget.org/packages/SmsIrRestful/
                                            var token = new Token().GetToken("userApikey", "secretKey");
                                            var verification = new VerificationCode();
                                            var messages = verification.MessageReport(token, MessageReportType.Verification, null, "1397/01/01", "1397/01/02");