Function bytes2BSTR(vIn) '用于Unicode-16和GB2312的转化
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
Function getHTTPPage(url) '用于获取来源页面的数据(Text)
on error resume next
dim http
set http=Server.createobject("Msxml2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then exit function
getHTTPPage=Http.responseText
set http=nothing
if err.number<>0 then err.Clear
End function
Function getHTTPPage_body(url) '用于获取来源页面的数据(Body)
on error resume next
dim http
set http=Server.createobject("Msxml2.XMLHTTP")
Http.ContentType=938
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then exit function
if err.number<>0 then err.Clear
getHTTPPage_BODY=bytes2BSTR(Http.responseBody)
set http=nothing