note 11510 added to gzopen
| From: | josh at topic dot com dot au | Date: | Fri, 23 Feb 2001 00:59:20 +0000 |
| Subject: | note 11510 added to gzopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11443@lists.php.net to get a copy of this message | ||
I have had some trouble trying to get the gzopen() function to open .gz files straight from a HTTP
connection.
here is what I had to do to get .gz files from a HTTP connection (Note that there is no error
checking here..).
$gzfile = fopen("www.test.com/testfile.gz", "rb");
$tempfile = fopen("temp_file.gz", "wb");
while (!feof($gzfile))
{
$char = fgetc($gzfile);
fputs($tempfile, $char);
}
fclose($tempfile);
fclose($gzfile);
$gzfile = gzopen("temp_file.gz", "r");
you can now use gzgets or gzread to read the .gz file.
I hope this helps someone.
http://www.php.net/manual/en/function.gzopen.php