28,406
社区成员
发帖
与我相关
我的任务
分享'=================================================|
'=================================================|
'获取静态网页内容;
'url 动态页的文件路径;
'=================================================|
function getHTTPPage(url)
dim httpxml
Set httpxml= server.CreateObject("msxml2.XMLHTTP")
httpxml.open "get",url,False
httpxml.send()
if httpxml.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Httpxml.responseBody,"GB2312")
set httpxml=nothing
if err.number<>0 then err.Clear
end function ' 2、转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换
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
<%
function getHTTPPage(byval url)
if instr(url,"?")>0 then
url=url&"&d="&now()
else
url=url&"?d="&now()
end if
dim httpxml
Set httpxml= server.CreateObject("msxml2.XMLHTTP")
httpxml.open "get",url,False
httpxml.send()
if httpxml.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Httpxml.responseBody,"GB2312")
set httpxml=nothing
if err.number<>0 then err.Clear
end function ' 2、转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换
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
%>