Reading a compressed file : fgets « File Directory « PHP






Reading a compressed file

 
<?php
$fh = fopen('compress.zlib://lots-of-data.gz','r') or die("can't open: $php_errormsg");
while ($line = fgets($fh)) {
    // $line is the next line of uncompressed data
}
fclose($fh) or die("can't close: $php_errormsg");
?>
  
  








Related examples in the same category

1.Checking for an error from fopen(), fgets(), or fclose()
2.Counting paragraphs in a file
3.Counting records in a file
4.Creating and Using a File Class
5.Reading a file a line at a time
6.fgets() function returns a string read from a file.
7.fgets.php
8.Processing a list of books
9.Processing each word in a file