网页抓取不成功的问题[已解决]
本帖最后由 gto250 于 2012-5-30 21:50 编辑$s=get("http://www.wyqx.gov.cn/" )
MsgBox(0,"",$s)
Func get($url)
$oHTTP = ObjCreate("Microsoft.XMLHTTP")
$oHTTP.Open ("Get",$url,False)
$oHTTP.SetRequestHeader ("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
$oHTTP.SetRequestHeader ("Accept-Encoding","gzip, deflate")
$oHTTP.SetRequestHeader ("Accept-Language","zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3")
$oHTTP.SetRequestHeader ("Cache-Control","max-age=0")
$oHTTP.SetRequestHeader ("Connection","keep-alive")
$oHTTP.SetRequestHeader ("Host","www.wyqx.gov.cn")
$oHTTP.SetRequestHeader ("User-Agent","Mozilla/5.0 (Windows NT 6.1; rv:13.0) Gecko/20100101 Firefox/13.0")
$oHTTP.SetRequestHeader ("Refer","www.wyqx.gov.cn")
$oHTTP.SetRequestHeader ("Cookie"," ASPSESSIONIDQCSATCBA=AHPOHPDCHOAFLOILHNKPDBJJ")
$oHTTP.Send ()
$post=$oHTTP.Responsebody
Return $post
Endfunc
以上代码抓取http://www.wyqx.gov.cn/这个网站的内容不成功,用InetRead也不行
但是用浏览器就能打开网页,真变态的网站
哪位兄弟能帮帮忙 回复 1# gto250
已经读出网页内容了呀, 但需要转码:
MsgBox(0,"",BinaryToString($s)) 回复 2# user3000
我这里读不出内容,是空白的,我是win7系统,这是怎么回事? 回复 3# gto250
我的是XP sp3 . 可能真是跟系统有关吧.
我这转码后, 与从网页浏览器里直接观看该网址的源码完全一致的.
页:
[1]