Android解压缩压缩字符串

For my android application it will retrieve data from the server in JSON format that has been compressed.

I use:

InputStream stream = new GZIPInputStream(entity.getContent());

To read the stream, this should decompress the data as I read it.

The problem is no matter what Gz algorithm I use on the server side(PHP) I get "Unknown format (Magic Number ____)" in my android application.

gzencode($json); //gives 1F20
gzcompress($json); //gives 7820

Ive tried a few different methods of decompressing the data, but they give the same errors.

Ideas?

Posting this in case someone else has the same dilemma as I do, I really just want to reduce network load for large data. CPU load isn't a concern.

I found this website: http://www.feedthebot.com/pagespeed/enable-compression.html

Very good guide on how to enable GZIP within the HTTP protocol, server side when modifying .htaccess file. Great solution for my problem. If anyone else has an answer to the above question specifically please post and ill mark it as the actual solution to the question.