format('Y-m-d H:i'); $ip = $_SERVER['REMOTE_ADDR']; $url = "http://ip-api.com/json/" . $ip; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $location = curl_exec($ch); curl_close($ch); $location = json_decode($location, true); $City = $location["city"]; $Country =$location["country"]; $Services = "Commercial (New build)"; $newEntry = $currentDateTime. " - " .$City. ", " .$Country. " - " .$Services. "\n"; $file = '../../listing-Client/viewCount/entries.txt'; $currentContent = file_exists($file) ? file_get_contents($file) : ""; // Combine the new entry with the existing content $updatedContent = $newEntry . $currentContent; // Write the updated content back to the file file_put_contents($file, $updatedContent); use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; use PHPMailer\PHPMailer\SMTP; require 'PHPMailer/src/Exception.php'; require 'PHPMailer/src/PHPMailer.php'; require 'PHPMailer/src/SMTP.php'; ?>
*Applicable to Commercial buildings only