Jump to content

Search For A File In A Zip


Zero3X

Recommended Posts

Basically I need to search through a zip file for one file. I've tried quite a few things but the zip functions are now really starting to annoy me.

 

My most recent attempt was this:

 

$zip = zip_open(myzip.zip);

while ($zip_file = zip_read($zip) != "file.php") {

}
zip_entry_open($zip, $zip_file);
  
  
	  $contents = zip_entry_read($zip_file);

 

But of course that just timed out on me.

 

Anyone got any ideas?

Link to comment
https://forums.phpfreaks.com/topic/216837-search-for-a-file-in-a-zip/
Share on other sites

That was a typo  ;D

 

When copy/pasting the actual code you are expecting help with, how can there be typo's?

 

It was a variable ($thezipfile = "myzip.zip") but it's seperated from the zip check section of the script by unrelated code. So I took the liberty of changing the variable to a string (and forgetting to use '"').

Well, I've managed to get this all working. However, when I echo out the contents of the file it only shows the second line.

 

The complete file

<div>
Hello - I only get this outputted.
<?php
function doesnoexist();
?>
</div>

 

Does zip_entry_read not process characters like "<, >, ?" ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.