I need to read files from ZIP archives with PHP. And my zip is not on the disk. It is accessible with http url. There is the extension ZipArchive . It works fine if a file is on disk . Is it possible to use this extension with some opened resource instead of opening a file by path?
Important note, i can not download a zip file temporary to disk. I can work only with the file remotely.
If not ZipArchive, maybe there are other similar libraries for Zip that can read from stream?
There is simple example which doesn't work.
$zip = new ZipArchive();
$fh = fopen('zipfiles/1.zip','r');
$status = $zip->open($fh);
if ($status !== TRUE) {
exit("Error $status");
}
echo "Number of files: ".$zip->numFiles;
But this one works fine
$zip = new ZipArchive();
$status = $zip->open('zipfiles/1.zip');
if ($status !== TRUE) {
exit("Error $status");
}
echo "Number of files: ".$zip->numFiles;