| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/software/smsc smpp installer/software/Services/PHP/sendmessage/ |
Upload File : |
<?php
include "../general.php";
include "../connect.php";
date_default_timezone_set('Africa/Lagos');
$cnt = 1;
$cnt2=0;
while($cnt ==1){
$query= "SELECT sn,username,sender,message,phonenumber FROM messagesent where sentcode ='1' and billcode ='1' and route='7' order by sn limit 1";
$con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
///Check connection
if (mysqli_connect_errno())
{
return '#';
die();
}
if(!$result= mysqli_query($con,$query))
{
mysqli_close($con);
return "#";
}
else
{
while ($row = mysqli_fetch_array($result))
{
$sn = $row[0];
$username = $row[1];
$sender = $row[2];
$message = $row[3];
$phonenumber= $row[4];
$message = str_replace('^',"'",$message);
echo "processing record" ."\n";
echo "username ". $username."\n";
echo "Sender " .$sender ."\n";
echo "$phonenumber " .$phonenumber ."\n";
echo "Message " . substr($message,0,30) ."\n";
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJjNWNkZGE1YS04YTcwLTQzMDYtOGVkZS1mZjVkNTJkZjBkNjIiLCJzZWNyZXQiOiI1NmMwNDdiMThkNmI0MTgyOGUxMWNhOWE2YmQwNTRiM2Q2MTJhZjgzYzU2NmFiMjk1OGY4MzhmZTc0NGYzOTAwIiwiaWF0IjoxNjc1NTQxMDg2LCJleHAiOjI0NjM5NDEwODZ9.FMRsi2oR8cOtTNM3zhn2vPv8jYjYFPC4OZSXUdtr4ZA' );
// prep the bundle
$msg = array
(
'sender' => $sender,
'destination' => $phonenumber,
'content' => utf8_encode($message)
);
$headers = array
(
'Authorization: ' . API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://api.thesmsworks.co.uk/v1/message/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $msg ) );
$results = curl_exec($ch );
curl_close( $ch );
echo "status " .$results."\n";
$results= str_replace(":",",", $results);
$results= str_replace("{","", $results);
$results= str_replace("}","", $results);
$results= str_replace('"',"", $results);
$values = explode(",",$results);
$messageid =$values[1];
$status =$values[3];
$cnt2++;
//update the record
$query = "update messagesent set sentcode ='2',result='0',track='1',messageid='$messageid',status='$status' where sn = $sn ";
$queryresponse = updateQuery($query);
sleep(5);
}
} //else
echo "\nTotal Messages sent ... ".$cnt2 ."\n". date("Y-m-d h:i:s",time())."\n";
sleep(15);
}//end main while
?>