MaazSMS API is build for MaazSMS - Bulk SMS Application For Marketing
MaazSMS API is build for MaazSMS - Bulk SMS Application For Marketing, (*1)
To run MaazSMS API you have to install MaazSMS Application on your server. For more details please visit: MaazSMS, (*2)
php >=5.6 MaazSMS - Bulk SMS Application For Markting
Via Composer, (*3)
composer require maazwebz/maazsms
And Via Bash, (*4)
git clone https://github.com/maazwebz/maazsms.git
### Step 1: If install MaazSMS API using Git Clone then load your MaazSMS API Class file and Use namespace., (*5)
require_once 'src/Class_Maaz_SMS_API.php'; use MaazSMS\MaazSMSAPI;
If install MaazSMS API using Composer then Require/Include autoload.php file in the index.php of your project or whatever file you need to use MaazSMS API classes:., (*6)
require 'vendor/autoload.php'; use MaazSMS\MaazSMSAPI;
set your API_KEY from https://mywebhost.com/sms-api/info
(your application install url), (*7)
$api_key = 'YWRtaW46YWRtaW4ucGFzc3dvcmQ=';
Change the from number below. It can be a valid phone number or a String, (*8)
$from = '8801721000000';
the number we are sending to - Any phone number, (*9)
$destination = '8801810000000';
You have to must include Country code at beginning of the phone number., (*10)
Replace your Install URL like https://mywebhost.com/sms/api
with https://1.dialogsms.pro/
sms/api
is mandatory on your install url, (*11)
$url = 'https://1.dialogsms.pro/sms/api';
// SMS Body, (*12)
$sms = 'test message from MaazSMS';
// Unicode SMS, (*13)
$unicode = '1'; //For Unicode message
// Voice SMS, (*14)
$voice = '1'; //For voice message
// MMS SMS, (*15)
$mms = '1'; //For mms message $media_url = 'https://yourmediaurl.com'; //Insert your media url
// Schedule SMS, (*16)
$schedule_date = '09/17/2018 10:20 AM'; //Date like this format: m/d/Y h:i A
// Create Plain/text SMS Body for request, (*17)
$sms_body = array( 'api_key' => $api_key, 'to' => $destination, 'from' => $from, 'sms' => $sms );
// Create Unicode SMS Body for request, (*18)
$sms_body = array( 'api_key' => $api_key, 'to' => $destination, 'from' => $from, 'sms' => $sms, 'unicode' => $unicode, );
// Create Voice SMS Body for request, (*19)
$sms_body = array( 'api_key' => $api_key, 'to' => $destination, 'from' => $from, 'sms' => $sms, 'voice' => $voice, );
// Create MMS SMS Body for request, (*20)
$sms_body = array( 'api_key' => $api_key, 'to' => $destination, 'from' => $from, 'sms' => $sms, //optional 'mms' => $mms, 'media_url' => $media_url, );
// Create Schedule SMS Body for request, (*21)
$sms_body = array( 'api_key' => $api_key, 'to' => $destination, 'from' => $from, 'sms' => $sms, 'schedule' => $schedule_date, );
Instantiate a new MaazSMS API request, (*22)
$client = new MaazSMSAPI();
Finally send your sms through MaazSMS API, (*23)
$response = $client->send_sms($sms_body, $url);
Get your all message, (*24)
$get_inbox=$client->get_inbox($api_key,$url);
Get your account balance, (*25)
$get_balance=$client->check_balance($api_key,$url);
MaazSMS API return response with json
format, like:, (*26)
{"code":"ok","message":"Successfully Send"}
Status | Message |
---|---|
ok |
Successfully Send |
100 |
Bad gateway requested |
101 |
Wrong action |
102 |
Authentication failed |
103 |
Invalid phone number |
104 |
Phone coverage not active |
105 |
Insufficient balance |
106 |
Invalid Sender ID |
107 |
Invalid SMS Type |
108 |
SMS Gateway not active |
109 |
Invalid Schedule Time |
110 |
Media url required |
111 |
SMS contain spam word. Wait for approval |