Created
August 21, 2022 12:04
-
-
Save mahdyar/183db674a46d69755494a5d948bcafaa to your computer and use it in GitHub Desktop.
سرویس سامانه پیامکی آسیاتک برای افزونه پیام کوتاه WHMCS وهاب آنلاین
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* | |
* | |
* | |
* Developed by Mahdyar.me | |
* Contact: [email protected] | |
* | |
* | |
* | |
*/ | |
define('SEND_URI', 'https://smsapi.asiatech.ir/api/message/send'); | |
define('PROXY', ''); | |
function info_asiatech() | |
{ | |
return array( | |
"name" => "آسیاتک", | |
"username_label" => "نام کاربری", | |
"password_label" => "رمز عبور", | |
"sendernumber_label" => "شماره ارسال کننده", | |
"pattern_label" => false, | |
"pattern" => true, | |
); | |
} | |
function status_asiatech($username, $password, $smsNumber) | |
{ | |
$postFields = array([ | |
"SourceAddress" => $smsNumber, | |
"MessageText" => 'تست ارسال پیامک', | |
"DestinationAddress" => '' | |
]); | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => SEND_URI, | |
CURLOPT_PROXY => PROXY, | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => '', | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, | |
CURLOPT_FOLLOWLOCATION => true, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_CUSTOMREQUEST => 'POST', | |
CURLOPT_POSTFIELDS => json_encode($postFields), | |
CURLOPT_HTTPHEADER => array( | |
'Authorization: Basic ' . base64_encode("$username:$password"), | |
'Content-Type: application/json' | |
), | |
)); | |
$response = curl_exec($curl); | |
curl_close($curl); | |
$response = json_decode($response); | |
if ($response->succeeded == true) | |
return true; | |
return false; | |
} | |
function balance_asiatech($username, $password, $smsNumber) | |
{ | |
$balanceURI = 'https://smsapi.asiatech.ir/api/user/userinfo'; | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => $balanceURI, | |
CURLOPT_PROXY => PROXY, | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => '', | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, | |
CURLOPT_FOLLOWLOCATION => true, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_HTTPHEADER => array( | |
'Authorization: Basic ' . base64_encode("$username:$password"), | |
'Content-Type: application/json' | |
), | |
)); | |
$response = curl_exec($curl); | |
curl_close($curl); | |
$response = json_decode($response); | |
if ($response->succeeded == true) | |
return $response->data->credit; | |
return false; | |
} | |
function sending_default_asiatech($username, $password, $smsNumber, $phoneNumbers, $text) | |
{ | |
$phoneNumbers = explode(",", $phoneNumbers); | |
foreach ($phoneNumbers as $phoneNumber) { | |
$phoneNumber = '98'.substr($phoneNumber, 1); | |
$postFields[] = [ | |
"SourceAddress" => $smsNumber, | |
"MessageText" => $text, | |
"DestinationAddress" => $phoneNumber | |
]; | |
} | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => SEND_URI, | |
CURLOPT_PROXY => PROXY, | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => '', | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, | |
CURLOPT_FOLLOWLOCATION => true, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_CUSTOMREQUEST => 'POST', | |
CURLOPT_POSTFIELDS => json_encode($postFields), | |
CURLOPT_HTTPHEADER => array( | |
'Authorization: Basic ' . base64_encode("$username:$password"), | |
'Content-Type: application/json' | |
), | |
)); | |
$response = curl_exec($curl); | |
curl_close($curl); | |
$response = json_decode($response); | |
if ($response->succeeded == true) | |
return true; | |
return false; | |
} | |
function sending_pattern_asiatech() | |
{ | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment