PHP Sample Code Send SMS
<?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";
//Your approved Principal Entity Id.
$pe_id = "12131313131313131";
//Your approved DLT Template Id.
$template_id = "12454524223223223";
//Prepare you post parameters
$postData = array(
'authkey' => $authKey,
'mobiles' => $mobileNumber,
'sender' => $senderId,
'message' => $message,
'pe_id' => $pe_id,
'template_id' => $template_id,
'route' => $route
);
//API URL
$url="https://apitxt.com/api/sendMsg?";
// 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;
?>