Using the zip:// wrapper for an archive with a single file whose name is unknown

Viewed 1881

PHP allows to read ZIP files on-the-fly with the zip:// wrapper:

$fp = fopen ('zip://archive.zip#dir/file.txt', 'rb');

All good, when you know the compressed file name. This is not my case: my app has to deal with ZIP archives containing a single file, whose name is unknown before opening the archive.

Is there an option to tell the wrapper to open the first file in the archive, without the file name?

I know I can use ZipArchive or Zip Functions, I'd just like to keep it simple and use the stream wrapper if possible.

1 Answers
Related