0

I have a simple test.txt file inside a zipped file called test.zip. The test.txt file only contains a string Hello@2015. Now I need to read the file by PHP like

<?php
$handle = fopen('test.zip#test.txt', 'r'); 
$result = '';
while (!feof($handle)) {
  $result .= fread($handle, 8192);
}
fclose($handle);
echo $result;

but I am getting this warnings Warning: fopen(test.zip#test.txt): failed to open stream: No such file or directory in C:\wamp\www\ZipRead\index.php on line 2

Warning: feof() expects parameter 1 to be resource, boolean given in C:\wamp\www\ZipRead\index.php on line 4

Warning: feof() expects parameter 1 to be resource, boolean given in C:\wamp\www\ZipRead\index.php on line 4

can you please let me know what I am doing wrong?

Ido
  • 2,034
  • 1
  • 17
  • 16
Suffii
  • 5,694
  • 15
  • 55
  • 92

0 Answers0