Viewing file: functions.php (1.94 KB) -rw-rw-r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
function send_otp_sms($phone,$message,$msgtype) {
/* Your Username */
$username = "srishti";
/* Your Password */
$password = "9895345468";
/* Multiple mobiles numbers separated by comma */
$mobileNumber = $phone;
/* Sender ID,While using route4 sender id should be 6 characters long. */
$senderId = "SRICAM";
$message = urlencode($message);
// $message = urlencode($rndno);
/* Define route */
$route = "2";
/* Prepare you post parameters */
$postData = array(
'uname' => $username,
'pwd' => $password,
'mobiles' => $mobileNumber,
'message' => $message,
'sender' => $senderId,
'route' => $route
);
$DltTemplateId='';
if($msgtype=='signup'){
$DltTemplateId='1207161530126047850';
}else if($msgtype=='signin') {
$DltTemplateId='1207161530117680218';
}
/* API URL */
// $url = "http://alvosms.in/api/v1/send?token=ivku4o2r6gjdq98bm3aesl50pyz7h1&numbers=" . $mobileNumber . "&route=" . $route . "&message=" . $message . "&sender=" . $senderId;
$url="http://alvosms.in/api/v1/send?token=ivku4o2r6gjdq98bm3aesl50pyz7h1&numbers=".$mobileNumber."&route=".$route."&message=".$message."&sender=".$senderId."&template-id=".$DltTemplateId;
// echo $url;die();
/* init the resource */
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
// CURLOPT_POST => true,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
// CURLOPT_POSTFIELDS => $postData
));
/* get response */
$output = curl_exec($ch);
// print_r($output);
/* Print error if any */
if (curl_errno($ch)) {
echo 'error:' . curl_error($ch);
}
curl_close($ch);
// echo 'OTP Sent Successfully !';
// die();
return $rndno;
}
|