File: //var/www/html/qcr24/app/application/helpers/sms_helper.php
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
function signup($phoneno)
{
$error = '';
$data = array();
$ch = curl_init();
$baseurl = 'https://2factor.in/API/R1/';
$message = "Thank you for singing up. Please login to www.prdtourism.in for booking and other details. -PRD Department";
$postfields = 'module=TRANS_SMS&apikey=7724f759-3a60-11ed-9c12-0200cd936042&to=' . $phoneno . '&from=WBPNRD&msg=' . $message;
curl_setopt($ch, CURLOPT_URL, $baseurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error = 'Error:' . curl_error($ch);
}
curl_close($ch);
$data['error'] = $error;
$data['response'] = json_decode($result);
//echo "<pre>"; print_r($data);
return $data;
}
function payment_confirmed($phoneno, $amount, $booking_no)
{
$error = '';
$data = array();
$ch = curl_init();
$baseurl = 'https://2factor.in/API/R1/';
$message = "Thank you for paying Rs. " . $amount . " .Your Booking ID " . $booking_no . " is confirmed. Please login to www.prdtourism.in for more details. WBPNRD -PRD Department";
$postfields = 'module=TRANS_SMS&apikey=7724f759-3a60-11ed-9c12-0200cd936042&to=' . $phoneno . '&from=WBPNRD&msg=' . $message;
curl_setopt($ch, CURLOPT_URL, $baseurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error = 'Error:' . curl_error($ch);
}
curl_close($ch);
$data['error'] = $error;
$data['response'] = json_decode($result);
//echo "<pre>"; print_r($data);
return $data;
}
function payment_cancelled($phoneno, $booking_no)
{
$error = '';
$data = array();
$ch = curl_init();
$baseurl = 'https://2factor.in/API/R1/';
$message = "Your Booking ID " . $booking_no . " is cancelled. Refund, if any, will be initiated shortly. Please login to www.prdtourism.in for more details. WBPNRD -PRD Department";
$postfields = 'module=TRANS_SMS&apikey=7724f759-3a60-11ed-9c12-0200cd936042&to=' . $phoneno . '&from=WBPNRD&msg=' . $message;
curl_setopt($ch, CURLOPT_URL, $baseurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error = 'Error:' . curl_error($ch);
}
curl_close($ch);
$data['error'] = $error;
$data['response'] = json_decode($result);
//echo "<pre>"; print_r($data);
return $data;
}
function offline_payment_confirmed($phoneno, $booking_no)
{
$error = '';
$data = array();
$ch = curl_init();
$baseurl = 'https://2factor.in/API/R1/';
$message = "Your Booking ID " . $booking_no . " is confirmed. Please login to www.prdtourism.in for more details. WBPNRD -PRD Department";
$postfields = 'module=TRANS_SMS&apikey=7724f759-3a60-11ed-9c12-0200cd936042&to=' . $phoneno . '&from=WBPNRD&msg=' . $message;
curl_setopt($ch, CURLOPT_URL, $baseurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error = 'Error:' . curl_error($ch);
}
curl_close($ch);
$data['error'] = $error;
$data['response'] = json_decode($result);
//echo "<pre>"; print_r($data);
return $data;
}
?>