XMLHTTP POST

打印 被阅读次数

XMLHTTP POST

<%
function GetSourceInfo(byval url)
dim xmlhttp,xmlget,bgpos,endpos
Set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP")
strA=server.urlencode("abc")
With xmlhttp
.Open "POST", url, False
.setRequestHeader "Content-Length",len(strA)
.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
.Send strA
if .status<>200 then
xmlget="error"
else
xmlget = bin2str(.responseBody)
end if
End With
set xmlhttp = nothing
GetSourceInfo=xmlget
end function
Function bin2str(binstr)
Const adTypeBinary = 1
Const adTypeText = 2
Dim BytesStream,StringReturn
Set BytesStream = Server.CreateObject("ADODB.Stream") '建立一个流对象
With BytesStream
.Type = adTypeText
.Open
.WriteText binstr
.Position = 0
.Charset = "GB2312"
.Position = 2
StringReturn = .ReadText
.close
End With
Set BytesStream = Nothing
bin2str = StringReturn
End Function
response.write(GetSourceInfo("http://www.xxx.com/index.asp"))
%>


--------------------------------------------------------------------------------
  相关文章
  弹出窗口和iframe..2004-1-12 17:23:18
  二十八条改善 ASP 性能和外观的技巧(三)2003-12-22 22:31:01
  二十八条改善 ASP 性能和外观的技巧(二)2003-12-22 22:30:27
  二十八条改善 ASP 性能和外观的技巧(一)2003-12-22 22:29:57
分类: 网页教程 日期:2003-12-22 查看:90   
登录后才可评论.