Alıntı

<?php
ob_start(); // çıktı tamponlamasını başlat

$ip_address = ''; // IP adresini al
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip_address = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip_address = $_SERVER['REMOTE_ADDR'];
}

$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://ipinfo.io/'.$ip_address.'/country',
CURLOPT_SSL_VERIFYPEER => false
));
$country_code = trim(curl_exec($curl));

if ($country_code != "TR") {
header("Location: https://smsvar.com/en");
exit(); // kodu durdur
} else {
ob_end_flush(); // çıktı tamponlamasını sonlandır
}

curl_close($curl);
?>

Bunu deneyin