Mox SMS API is build for Mox SMS - Bulk SMS Application For Marketing
To run Mox SMS API you have to register to Mox SMS services. For more details please visit: Mox SMS
php >=5.6
Mox SMS - Bulk SMS Application For Markting
Via Composer
composer require shamim/Mox-sms-api
And Via Bash
git clone https://github.com/moxsms/sms-api/Mox-sms-api.git
If install Mox SMS API using Git Clone then load your Mox SMS API Class file and Use namespace.
require_once 'src/Class_Mox_SMS_API.php';
use MoxSMS\MoxSMSAPI;
If install Mox SMS API using Composer then Require/Include autoload.php file in the index.php of your project or whatever file you need to use Mox SMS API classes:.
require 'vendor/autoload.php';
use MoxSMS\MoxSMSAPI;
set your API_KEY from https://www.moxsms.com/sms-api/info
$api_key = 'YWRtaW46YWRtaW4ucGFzc3dvcmQ=';
Change the from number below. It can be a valid phone number or a String
$from = '8801721000000';
the number we are sending to - Any phone number
$destination = '8801810000000';
You have to must include Country code at beginning of the phone number.
Replace your Install URL like https://www.moxsms.com/sms/api
$url = 'https://www.moxsms.com/sms/api';
// SMS Body
$sms = 'test message from Mox SMS';
// Unicode SMS
$unicode = '0'; //For plain message
$unicode = '1'; //For Unicode message
// Create SMS Body for request
$sms_body = array(
'api_key' => $api_key,
'to' => $destination,
'from' => $from,
'sms' => $sms,
'unicode' => $unicode,
);
Instantiate a new Mox SMS API request
$client = new MoxSMSAPI();
Finally send your sms through Mox SMS API
$response = $client->send_sms($sms_body, $url);
Get your all message
$get_inbox=$client->get_inbox($api_key,$url);
Get your account balance
$get_balance=$client->check_balance($api_key,$url);
Mox SMS API return response with json
format, like:
{"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 |