Re: uncompressing gz string
| From: | Ray | Date: | Fri, 24 Oct 2003 19:31:06 +0000 |
| Subject: | Re: uncompressing gz string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167484@lists.php.net to get a copy of this message | ||
i had a similar problem, it seems that a .gz file had 10 bytes of
header that inflate and uncompress didn't like, or something wierd
like that. but i can't find the code that i had in the end.
http://www.php.net/manual/en/function.gzinflate.php
but depending on how your actually using the data, one of the 'read
from the file' might serve you better
http://www.php.net/manual/en/function.gzread.php
http://www.php.net/manual/en/function.gzgets.php
http://www.php.net/manual/en/function.gzpassthru.php
On Friday 24 October 2003 13:48, you wrote:
> I don't understand why gzinflate and gzuncompress don't work?
>
> <?php
> $gz_content = file_get_contents('hello.txt.gz');
>
> echo gzinflate($gz_content);
> // Warning: data error
>
> echo gzuncompress($gz_content);
> // Warning: data error
> ?>
>
> but if I make it from bash the content is there :
> cat hello.txt.gz | gunzip
> Hello!