Showing posts with label SMS Gateway Integration. Show all posts
Showing posts with label SMS Gateway Integration. Show all posts

How to integrate the Bulk SMS Provider API in PHP

Hi, In this tutorial, I am going to explain how to integrate the Bulk SMS Provider API in PHP.

What is Bulk SMS Provider API ?
Bulk SMS Provider is extended message service through Their software has provided a bulk full of messaging feature connecting all of us across the entire country. This service has whacked the other previously used SMS services through its speedy and accessible benefits. This has offered high connectivity, the best service, and message flow in an efficient way.

First, We need to register at the http://bulksmsserviceproviders.com/

Bulk SMS Provider  offers a free trial with 25 Transactional credits for testing purpose.
These Transactional  messages even mobile is on DND also a message will be sent.

Here we need to provide the original information i.e valid mobile number and email because your Bulk SMS Provider will send the verification code to the registered mobile number only.

How find your authentication key
Click  Developer Tools on the right navbar it will redirect to the Developer Tools page .

after the click Auth Key on the right navbar .


It will pop up the authentication key.









bulkSms.php
<?php
//Your authentication key
$authKey = "YourAuthKey";
//Multiple mobiles numbers separated by comma
$mobileNumber = "9999999";
//Sender ID,While using route4 sender id should be 6 characters long.
$senderId = "102234";
//Your message to send, Add URL encoding here.
$message = rawurlencode("Test message");
//Define route 
$route = "template";
//Prepare you post parameters
$postData = array(
    'authkey' => $authKey,
    'mobiles' => $mobileNumber,
    'message' => $message,
    'sender' => $senderId,
    'route' => $route
);
//API URL
$url = "http://sms.bulksmsserviceproviders.com/api/send_http.php";
// init the resource
$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $postData
    //,CURLOPT_FOLLOWLOCATION => true
));
//Ignore SSL certificate verification
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
//get response
$output = curl_exec($ch);
//Print error if any
if (curl_errno($ch)) {
    echo 'error:' . curl_error($ch);
}
curl_close($ch);
echo $output;
?>

* If you like this post please don’t forget to subscribe Techies Badi - programming blog for more useful stuff

How to integrate the SMS gateway hub API in PHP

Hi, In this tutorial, I am going to explain how to integrate the SMS gateway hub API in PHP.

What is SMS gateway hub ?
SMS gateway hub is an SMS provider in India. It will allow to easily send & manage texts from PC, Web, Android, API or Excel.

First, We need to register at the https://www.smsgatewayhub.com/

SMS gateway hub  offers a free trial with 20 to 40 credits for testing purpose.

Here we need to provide the original information i.e valid mobile number and email because your SMS gateway hub  account username & password will be sent to the registered mobile number only.

After that, you will get a call from SMS gateway hub . They will ask you,
 Do you want promotional credits or transactional credits ?

Then you will ask them to give the promotional credits, Then they will credit the  20 to 40 promotional credits to your account.

Each credit equals to one SMS
i.e 20 credits = 20 SMS

API key is found at API Documents -> API Codes






sendSMS.php
<?php  
 function sendSMS($mobile,$message){  
 $user = "YOUR-API-KEY-HERE";  
 $url = 'http://login.smsgatewayhub.com/api/mt/SendSMS?APIKey='.$user.'&senderid=WEBSMS&channel=INT&DCS=0&flashsms=0&number='.$mobile.'&text='.$message.'&route=16;';  
 $ch=curl_init($url);  
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  
 curl_setopt($ch,CURLOPT_POST,1);  
 curl_setopt($ch,CURLOPT_POSTFIELDS,"");  
 curl_setopt($ch, CURLOPT_RETURNTRANSFER,2);  
 $data = curl_exec($ch);  
 print($data); /* result of API call*/  
 }  
?>  
Call the sendSMS function with two parameters, Those are mobile number and message.
<?php  
 $message = rawurlencode("Your message here");  
 sendSMS("919XXXXXXXXX",$message);  
 ?>  
Here 91 is the country code of India.
Output:
{"ErrorCode":"000","ErrorMessage":"Success","JobId":"36049283","MessageData":[{"Number":"919XXXXXXXXX","MessageId":"NGQPxdsUL0i5gaciWDMbxQ"}]}

Download
* If you like this post please don’t forget to subscribe Techies Badi - programming blog for more useful stuff