娱乐新地带论坛

娱乐新地带论坛 (https://bbs.1819.net/index.php)
-   『程序设计』 (https://bbs.1819.net/forumdisplay.php?f=20)
-   -   XMLHTTP POST 接收整个网页 (https://bbs.1819.net/showthread.php?t=218)

Tony 2004-07-24 01:17 PM

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"))
%>


所有时间均为北京时间。现在的时间是 06:53 PM

©2003-2024 1819.net All rights reserved. © 2024