Bluehost.com Web Hosting $6.95

uncompressing gz string

This is a discussion on uncompressing gz string within the PHP General forums, part of the PHP Programming Forums category; I don't understand why gzinflate and gzuncompress don't work? <?php $gz_content = file_get_contents('hello.txt.gz'); echo gzinflate($...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-24-2003
Decapode Azur
 
Posts: n/a
Default uncompressing gz string

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!
Reply With Quote
  #2 (permalink)  
Old 10-24-2003
Adam Zey
 
Posts: n/a
Default Re: uncompressing gz string

I've had the exact same problem. I get .html.gz files uploaded to me. My
script does a file_get_contents on those, and then tried to use gzinflate or
gzuncompress. Neither works. Instead I use a shell command to use the 'gzip'
program to do the decompression.

This is a big bug that's been around a while, I'm surprised it hasn't been
fixed.

Regards, Adam.

"Decapode Azur" <blue_prawn@tuxfamily.org> wrote in message
news:200310242045.46406.blue_prawn@tuxfamily.org.. .
> 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!



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.530 / Virus Database: 325 - Release Date: 22/10/2003
Reply With Quote
  #3 (permalink)  
Old 10-24-2003
Ray
 
Posts: n/a
Default Re: [PHP] uncompressing gz string

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!

Reply With Quote
  #4 (permalink)  
Old 10-24-2003
Curt Zirzow
 
Posts: n/a
Default Re: [PHP] Re: uncompressing gz string

* Thus wrote Adam Zey (guspaz@gus.ath.cx):
> I've had the exact same problem. I get .html.gz files uploaded to me. My
> script does a file_get_contents on those, and then tried to use gzinflate or
> gzuncompress. Neither works. Instead I use a shell command to use the 'gzip'
> program to do the decompression.
>
> This is a big bug that's been around a while, I'm surprised it hasn't been
> fixed.


I dont see any open issues in bugs.php.net related to this.

Curt
--
"My PHP key is worn out"

PHP List stats since 1997:
http://zirzow.dyndns.org/html/mlists/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:55 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0