decode a web page with Content-Encoding: gzip

Home made / NONE
January 16, 2010 at 22:45:47
Specs: Windows XP, 2.8 ghz / 2 gig
I'm using sockets to get a webpage and have run into a problem. The page i'm getting is encoded with gzip. I have tried using the accept-encoding property to get it unencoded but the website won't send anything except the encoded page.

The script i'm using to get this can't do anything with the "gibberish" returned so I need a way to take an html file which i make from the info the socket receives and decode that into normal html.

Basically I have and wish to convert it to plain html. How can I do that on my computer?

See More: decode a web page with Content-Encoding: gzip

Report •

January 17, 2010 at 13:04:37
delete whatever you did and add this to your .htaccess

ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000

once thats done you can also compress your webpages and delete all the comments using some php scripts

use this :

once thats done add this at the start of the website

<? ob_start(“ob_gzhandler”); ?>

and this to the end

<? ob_end_flush();?>

hope it helps ;)

Report •

January 17, 2010 at 13:10:22
W.T.F! are you talking about?

You completely lost me and you can't have understood what I want help with. My problem has NOTHING to do with my website.

I am getting a web page from some random site and it's compressed with gzip. I want to uncompress it after i get it via a socket in a script.

Report •

January 19, 2010 at 23:07:06
In what language is your script written?

In php you'd use: gzdecode

In perl you'd use: IO::Compress::Zlib

In C you'd use: zlib

Or you can just pipe it to gunzip from the shell:
cat file.gz | gunzip

Report •

Related Solutions

January 20, 2010 at 05:07:01
Well i already solved this problem.

I skipped using the script that can't handle compressed webpages in sockets and used python. Then i socketed the needed info back to the other script.

Report •

Ask Question