当用curl取有些压缩网站的时候 又想取到头部
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, 1);
$content=curl_exec($ch);
curl_close($ch);
取回来的内容是:
HTTP/1.1 200 OK
Date: Fri, 12 Aug 2011 07:07:59 GMT
Server: Apache
Set-Cookie: PHPSESSID=ekda6bsph83mltvna208belhj5; path=/
Expires: Fri, 12 Aug 2011 07:07:59 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Last-Modified: Fri, 12 Aug 2011 07:07:59 GMT
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 2547
Keep-Alive: timeout=300
Connection: Keep-Alive
Content-Type: text/html; charset=gb2312秒DF胍yc余嬸革x栠Wm'$~0P;~馦M?趹g趋雄巺?0捈鐃?憿腤V㏕`??c爗笍?Ojt慧VCb?再c書鏗鄕b丆?杘F]衆?f?f肸B...其实是头部+压缩内容,问题是我怎么才能读取压缩的内容呢,即网站返回的内容。如果不要头部即去掉 直接curl_setopt($ch, CURLOPT_HEADER, 1); 
把取回来的内容保存到file.gz 文件就可以打开。急啊,就剩最后20分了,谢谢回答啊。