Set xmlHttp = CreateObject("microsoft.xmlhttp")
Set oShell = CreateObject("WScript.Shell")
sCurrDir = oShell.CurrentDirectory
Function GetPage(Method,Url,Async,PostContent,FileName)
xmlHttp.open Method,Url,Async
If Method = "POST" Then
xmlhttp.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
xmlhttp.setRequestHeader "Content-Length",Len(PostContent)
End If
xmlHttp.send(PostContent)
If Async = False Then GetPage = BytesToBstr(xmlHttp.responseBody,"GB2312",FileName) Else GetPage = ""
End Function
Function BytesToBstr(body,Cset,FileName)
Set objstream = CreateObject("ADODB.Stream")
with objstream
.Type = 1
.Mode =3
.Open
.Write body
If not trim(FileName)="" Then .SaveToFile LCase(FileName),2
.Position = 0
.Type = 2
.Charset = Cset
End With
BytesToBstr = objstream.ReadText
objstream.Close
End Function