2004-07-24, 01:17 PM | #1 |
注册日期: 2003-10-22
帖子: 11,053
积分:6
精华:24
现金:14348金币
资产:29325305金币
|
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")) %> |
|