SMS Gateway Integration in PHP

Nowadays there are various requirements for integrating SMS gateway in PHP .
Some example are sending OTP to user for authentication , sending order details , confirmation details ,sending notification , sales offer etc .
Before integrating in PHP, you should have to purchase a good SMS gateway provider You can find lots of SMS gateway provider in google buy searching
ex ‘Best SMS gateway provider in Delhi/NCR‘ . After buying it , now it’s time to integrate it in our PHP application .

Easy SMS gateway integration with PHP,Mysql
Well, SMS gateway integration in PHP is really simple process .It doesn’t take too much time. Generally these gateway provides 3 types of plan
1) One way messages ,2) Two way messages, 3) Both ways messages . Here one ways only allow to send message to customer but two way also allow to receive reply messages
from customers .

Depending upon SMS Gateway provider , API may quite from each other . Generally we have to pass some parameters to there callback url of API to send messages .
There parameters are sender number , receiver number , message content etc . Below I have listed a simple code to send SMS through PHP. You can change or add parameter according to your SMS gateway provider API.

//all parameters in array
$apiParams = array(
    'user' => 'put_your_username',
    'apiKey' => 'put_your_api_key',
    'senderID' => 'put_your_sender_id',
    'receipientno' => 'put_receiver_contact_no',
    'message' => 'Put sms message here'

//merge API url and parameters
$apiUrl = "";
foreach($apiParams as $key => $val){
    $apiUrl .= $key.'='.urlencode($val).'&';
$apiUrl = rtrim($apiUrl, "&");

//API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);


Note : Above we used cURL so make sure cURL library enable in PHP .

Online Web Development Training,Video Tutorials