怪事了,为什么无法采集???

fisherboy 2009-08-08 12:45:23

Function GetHTTPPage(url)
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
Set Http=Nothing
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
End Function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

d1="http://www.baidu.com"
d2=server.mappath("/head.html")

response.write "<div>111111</div>"

myHeadData=GetHTTPPage(d3)

response.write "<div>22222</div>"

response.write myHeadData

If myHeadData="" then
response.write "<div>333333</div>"
End If



发现采集本地的文件有用采集远程的就没用。


怎么解决?
...全文
68 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
poiuy343 2009-08-08
  • 打赏
  • 举报
回复
http://download.csdn.net/source/1537873
参考下我写的代码
hookee 2009-08-08
  • 打赏
  • 举报
回复
改成Msxml2.ServerXMLHTTP
set http=Server.createobject("Msxml2.ServerXMLHTTP")

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧