'// 1. Enter the url of the target webpage. The returned value getHTTPPage is the html code of the target webpage.
Function getHTTPPage(url)
url=cstr(url)
dim Http
set Http=server.createobject("MSXML2.ServerXMLHTTP") ' Response.write url
' Response.end
Call Http.setTimeouts(90000,90000,90000,90000)
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"utf-8")
set http=nothing
if err.number<>0 then err.Clear
End Function
'// 2. If you use xmlhttp to call a webpage with Chinese characters, you can use the adodb. stream component to convert the webpage.
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream") objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function