<?php
    /*Send SMS using PHP*/    
    
//Your authentication key
$apikey = "YourAPIKEY";
//Approved sender id(6 characters string only).
$senderid = "TESTIN";
//Message channel Promotional=1 or Transactional=2.
$channel = "2";
//Default is 0 for normal message, Set 8 for unicode sms.
$DCS = "0";
//Default is 0 for normal sms, Set 1 for immediate display.
$flashsms = "0";
//Recipient mobile number (pass with comma seprated if need to send on more then one number).
$number = "9198981XXXXX";
//Your message to send.
$message = "Test message";
//Define route
$route = "default"; //Prepare you post parameters
$postData = array(
'apikey' => $apikey,
'senderid' => $senderid,
'channel' => $channel,
'DCS' => $DCS,
'flashsms' => $flashsms
'number' => $number
'message' => $message
'route' => $route
);
//API URL
$url="https://www.smsgatewayhub.com/api/mt/SendSMS?";
// 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; ?>