在本地可以获取远程网页源码,在服务器上不能获取远程网页源码
<%
url="http://www.tudou.com"
response.write server.HTMLEncode(getSource(url))
Server.Scripttimeout=9999999
Function getSource(Path)
T = Getbody(Path)
getSource=Bytestobstr(T,"utf-8")
End Function
Function Getbody(Url)
On Error Resume Next
Set Retrieval = Createobject("Microsoft.Xmlhttp")
With Retrieval
.Open "Get", Url, False, "", ""
.Send
Getbody = .Responsebody
End With
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.163.com"却是可以获取网页的源文件,很是郁闷求高手...