GoSMS API is build for GoSMS - Bulk SMS Application For Marketing
To run GoSMS API you have to install GoSMS Application on your server.
php >=5.6
GoSMS - Bulk SMS Application For Markting
Via Composer
composer require levart/go-sms-api
And Via Bash
git clone https://github.com/gosms-ge/GoSMS.GE-API.git
If install GoSMS API using Git Clone then load your GoSMS API Class file and Use namespace.
require_once 'src/Class_Go_SMS_API.php';
use GoSMS\GoSMSAPI;
If install GoSMS API using Composer then Require/Include autoload.php file in the index.php of your project or whatever file you need to use GoSMS API classes:.
require 'vendor/autoload.php';
use GoSMS\GoSMSAPI;
set your API_KEY from https://mywebhost.com/sms-api/info
(your application install url)
$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://mywebhost.com/sms/api
is mandatory on your install url
// SMS Body
$sms = 'test message from GoSMS';
// 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 GoSMS API request
$client = new GoSMSAPI();
Finally send your sms through GoSMS 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);
GoSMS 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 |
- Levan Jmukhadze - Initial work - levart