enjoy with a cup of coffe
$download_url = "http://nukeviet.byethost5.com/file.zip"; // url to zip file you want to download
$delete = "no"; // if you DO NOT want the .zip file to be deleted after it was extracted set "yes" to "no".
/* don't touch nothing after this line */
$file = "file.zip";
$script = basename($_SERVER['PHP_SELF']);
// download the file
file_put_contents($file, fopen($download_url, 'r'));
// extract file content
$path = pathinfo(realpath($file), PATHINFO_DIRNAME); // get the absolute path to $file (leave it as it is)
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
$zip->extractTo($path);
$zip->close();
echo "$file extracted to $path
";
if ($delete == "yes") { unlink($file); } else { echo "remember to delete $file & $script!"; }
} else {
echo "Couldn't open $file";
}
?>