<?php

// get ambil link subtitles
$ch = curl_init();
$source = "https://subscene.com/subtitles/indonesian-text/sF7xueKBwW28EgIwhb1uJ7pPCgUr6QZuXHvsHTS9Hh_PMCgfvMT6IJVwZ-jqRNEkYot1poTl5QVw_bQWaU6jHX6Vhz1Q8UHMEg0PUp3HqXzAISdaV3Gp5hSjQ3xB38n20"; // THE FILE URL
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
curl_close ($ch);

// save as subs.zip
$destination = "subs.zip"; // NEW FILE LOCATION
$file = fopen($destination, "w+");
fputs($file, $data);
fclose($file);

echo " subs.zip downloaded; ";

// unzip
$zip = new ZipArchive;
$res = $zip->open('subs.zip'); // buka zip
if ($res === TRUE) {
    $zip->extractTo('.'); // extract
    $zip->close();
    echo ' subs.zip extracted; ';
    unlink('subs.zip');
    echo ' subs.zip deleted; ';
} else {
    echo ' unzip failed; ';
}

Leave a Reply

Your email address will not be published. Required fields are marked *