Function GetBody(weburl)
'創建對象
Dim ObjXMLHTTP
Set ObjXMLHTTP=Server.CreateObject("MSXML2.serverXMLHTTP")
'請求文件,以異步形式
ObjXMLHTTP.Open "GET",weburl,False
'此信息必須在send前一個設置否則將出錯"msxml3.dll error '80004005' Unspecified error"
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
'如果下面的方法在調用時使用()則會出現以下錯誤,如果非要使用()則需要使用call來調用方法
“ Microsoft VBScript compilation error '800a0414'Cannotuse parentheses when calling a Sub”
'xmlhttp.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded")
ObjXMLHTTP.send
While ObjXMLHTTP.readyState <> 4
ObjXMLHTTP.waitForResponse 1000
Wend
'得到結果
GetBody=ObjXMLHTTP.responseBody
'釋放對象
Set ObjXMLHTTP=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