一个采集问题(本地可以,网上就不行了)
以下代码我在本地测试正常,在服务器上就不行了.
同样的代码,换成其他别的网站地址又可以了,不知道是那里的问题!
<%
Function Gethttppage(Path)
T = Getbody(Path)
Gethttppage=Bytestobstr(T,"Gb2312")
End Function
Function Getbody(Url)
Set Retrieval = CreateObject("MSXML2.serverXMLHTTP")
'Set Retrieval = Server.CreateObject("Msxml2.XMLHTTP")
With Retrieval
.Open "Get", Url, False, "", ""
.Send
Getbody = .Responsebody
End With
If Http.Retrieval<>4 then
response.write "获取远程文件 "&url&" 失败。"
Set Http=Nothing
Exit function
End if
Set Retrieval = Nothing
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
url="http://www.mie168.com/manage/peixun.htm"
Wstr=Gethttppage(Url)
response.write wstr
%>