The best way to do this is to copy the remote file to a temporary one:
$file = 'http://remote/url/file.zip'; $newfile = 'tmp_file.zip'; if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; }
Then you can do whatever you want with a temporary file:
$zip = new ZipArchive(); if ($zip->open($newFile, ZIPARCHIVE::CREATE)!==TRUE) { exit("cannot open <$filename>\n"); }
source share