WEB-ASP:返回一个ASP页面执行后的静态HTML代码
2008-08-31 12:54:31 来源:WEB开发网核心提示:用这个获取页面内容,然后用邮件发出去!下面是远程获取内容的代码 content=getHTTPPage("http://www.google.net") response.write content function getHTTPPage(url) on error resume ne
用这个获取页面内容,然后用邮件发出去!下面是远程获取内容的代码
content=getHTTPPage("http://www.google.net")
response.write content
function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Msxml(标准化越来越近了)2.xml(标准化越来越近了)HTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then exit function
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
content=getHTTPPage("http://www.google.net")
response.write content
function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Msxml(标准化越来越近了)2.xml(标准化越来越近了)HTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then exit function
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
更多精彩
赞助商链接