请教大家,看到别人的asp源码中用CreateObject("Microsoft.XMLHTTP"
,能读取指定网站上的内容,觉得功能很强大,可是.net中怎么MSDN里找不到介绍?
源码如下:
Function GetPage(url)
Dim Retrieval
Set Retrieval = CreateObject("Microsoft.XMLHTTP"
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body)
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 = "gb2312"
'objstream.Charset = "UTF-8"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function