<?php 
//error_reporting(0);
date_default_timezone_set("Asia/Kolkata");
include("../config.php");
include("send_sms.php");

$dateToday = date('Y-m-d');
$nextDate = date('Y-m-d',strtotime('+7 days'));

$sqlClientName =  "SELECT * FROM tbl_login WHERE status = 'Active' AND expDate BETWEEN '$dateToday' AND '$nextDate' ";
$queryClientName = mysqli_query($con,$sqlClientName);
$numCountClientName = mysqli_num_rows($queryClientName);
$output = '';
if($numCountClientName > 0){
    $i = 1;
    while($rowClientName = mysqli_fetch_array($queryClientName)){
        $mobile = $rowClientName['Usr_Phone'];
        $message = '';
        $expiryDate = $rowClientName['expDate'];
        
        $date1 = new DateTime($dateToday);
        $date2 = new DateTime($expiryDate);
        
        // Calculate the difference
        $interval = $date1->diff($date2);
        
        // Get the number of days
        $days = $interval->days .' days';
        $message = smsString($rowClientName['cName'],$days,$expiryDate);
        $smsString = sendSMS(urlencode($mobile), urlencode($message), 'sendOTP');
        $json = json_decode(file_get_contents($smsString), true); // Decode the JSON response
    }
    
}
   
?>