How To Run Bulk SMS API In PHP?

It is very simple to combine bulk SMS API in PHP, users can easily get the respective codes from API panel within a fraction of seconds. MSG91 is a one of the growing company which provides API for bulk SMS that can easily be integrated with PHP code.

In the market, there are so many service provider companies which provide API solutions across the world, but you need to select that service provider who offers best quality services at affordable price. For start-ups, it is most important to choose flexible service provider so that they can target a large audience and make new clients. But it is true, choosing the best service provider company is not a game of kids, so before taking API services from any company must check it on the basis of quality and pricing factor.

Before API integration it is necessary to check the following things in the service:

* Instant delivery of SMS

* Wheather they are giving delivery report within 24 hours or not

* 24×7 customer Support

* Easy Integration of API with particular portal or website

* Delivery ratio of Promotional SMS should be 10:8

* Delivery ratio of transactional SMS should be 10:10

Steps to integrate API with PHP To Run Bulk SMS

* First select the service provider company from which you want to take API

* Then create an account and generate a password

* Store it in the session

* Integrate API PHP file in your respective application

* Get PHP code from the user

* Then check user code, if it is correct then start process

For Example:

<?php
/*Send SMS using 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 = urlencode(“Test message”);

//Define route
$route = “default”;
//Prepare you post parameters
$postData = array(
‘authkey’ => $authKey,
‘mobiles’ => $mobileNumber,
‘message’ => $message,
‘sender’ => $senderId,
‘route’ => $route
);

//API URL
$url=”https://control.msg91.com/api/sendhttp.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;
?>