<?php
include("config.php");
$currentdatetime = date("Y:m:d H:i:s");
$message = urlencode($_GET["message"]);
$mask = urlencode($_GET["mask"]);
$number = urlencode($_GET["number"]);
$smsID = urlencode($_GET["messageId"]);
$Uname = urlencode($_GET["Uname"]);
//$Upass = urlencode("High9High!@#41"); // $_GET["Upass"]
$Upass = urlencode($_GET["Upass"]); // 
$api_unicode= urlencode($_GET['api_unicode']);
$tablesname= urlencode($_GET['tablesname']);
$filedname= urlencode($_GET['filedname']);
$weburl = "https://bsms.ufone.com/bsms_v8_api/sendapi-0.3.jsp?id=".$Uname."&password=".$Upass."&shortcode=".$mask."&mobilenum=".$number."&message=".$message."&messagetype=Transactional&lang=".$api_unicode;
echo $weburl;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $weburl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
//var_dump($result); die ; 
//var_dump(curl_getinfo($ch));
$errors = curl_error($ch);
if(!$result){
 $result = $errors ; 
}
//echo $result ; 
 //$errors. "= Api Connection Failure";
 curl_close($ch);
$currentdatetime = date("Y:m:d H:i:s");

$sqlUpdateSMS="UPDATE ".$tablesname." SET ".$filedname."='".urlencode($result)."',response_time='".$currentdatetime."' where id='$smsID'";
//echo $sqlUpdateSMS ; 
$queryUpdateSMS=mysqli_query($connect,$sqlUpdateSMS);
?>