File: /var/www/nclive/backend/sendsmsapi.php
<?php
class Sendsms {
public function sendMessage($senderId, $mobile, $encodedMessage, $type, $otp){
$Msgid = '20181604';
$Msgpwd = '7H99t99V';
$service_url = 'http://164.52.195.161/API/SendMsg.aspx?uname='.$Msgid.'&pass='.$Msgpwd.'&send='.$senderId.'&dest='.$mobile.'&msg='.$encodedMessage;
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 20);
$curl_response = curl_exec($curl);
// print_r($curl_response);
if ($curl_response === false) {
$info = curl_getinfo($curl);
curl_close($curl);
die('error occured during curl. Additioanl info: '. var_export($info));
}
curl_close($curl);
}
}
// error_reporting(E_ALL);
// ini_set('display_errors', 'ON');
// $senderId = 'GRAPOS';
// $mobile = '9015264177';
// $otp = rand(1111, 9999);
// $mnt_message = "OTP to approve registration for Naukri Connect is " . $otp . ". Please do not share this OTP with anyone.\nGraposs Connect";
// $encodedMessage = urlencode($mnt_message);
// $type = 'NORMAL';
// $obj = new Sendsms();
// $var = $obj->sendMessage($senderId, $mobile, $encodedMessage, $type, $otp);
// print_r($var);
?>