- 论坛徽章:
- 0
|
recv(sock, recv_buff, BUFSIZE, 0)) > 0 |
用这个函数接收到的目标url页面内容每次不一样.比如我测试自己的一个页面.有两种情况(注: BUFSIZE长度为1024*100,数组长度绝对够)
....<gameId>8</gameId>
</SubTable>
</root>
3148//这是获取的字符串总长度,正常
<SubTable>
<name
1380//这次不正常了,这个 "1380" 很怪异,好多个页面出错都是这个长度
PS:另问个问题,我获取百度首页也是两种情况,但是....
HTTP/1.1 200 OK
Date: Wed, 11 Feb 2009 03:04:08 GMT
Server: BWS/1.0
Content-Length: 1990
Content-Type: text/html
Cache-Control: private
Expires: Wed, 11 Feb 2009 03:04:08 GMT
Content-Encoding: gzip
Set-Cookie: BAIDUID=411A4901BD5BB0A57ED05E3AB57C5E24:FG=1; expires=Wed, 11-Feb-39 03:04:08 GMT; path=/; domain=.baidu.com
P3P: CP=" OTI DSP COR IVA OUR IND COM "
372//这是长度
HTTP/1.1 200 OK
Date: Wed, 11 Feb 2009 03:04:53 GMT
Server: BWS/1.0
Content-Length: 1990
Content-Type: text/html
Cache-Control: private
Expires: Wed, 11 Feb 2009 03:04:53 GMT
Content-Encoding: gzip
Set-Cookie: BAIDUID=C55B5B970EC85E4F6EF25829E828BF60:FG=1; expires=Wed, 11-Feb-39 03:04:53 GMT; path=/; domain=.baidu.com
P3P: CP=" OTI DSP COR IVA OUR IND COM "
?
2362//这也是长度
第二种情况和取163首页类似,都是body,即我们通常说的网页源代码是看不到,但是却占用了长度,看header是有进行了gzip压缩,那么请问,对于有gzip压缩的网页源代码如何进行解压缩处理,并能分离header和源代码.
另外我是新手,刚学一两周,是PHPER出身,对C很多的概念很难理解,希望对于提出的一些弱智问题请高手见谅 |
|