您的位置:首页 > 理论基础 > 计算机网络

[C]通过XMLHTTP获取CGI/PHP等程序的返回值

2006-03-17 18:38 309 查看
function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "POST",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
end function
Private 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

Dim Str_Url,Result
Result = getHTTPPage(Str_Url)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: