<%
Function GetBody(weburl)
dim objXMLHTTP
set objXMLHTTP=Server.CreateObject("MSXML2.serverXMLHTTP")
objXMLHTTP.Open "GET",weburl,false
objXMLHTTP.send
while objXMLHTTP.readyState<>4
objXMLHTTP.waitForResponse 1000
wend
GetBody=BytesToBstr(objXMLHTTP.responseBody,"GB2312")
set objXMLHTTP=nothing
End Function
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 RegBody(wstr,regstr,index)
set reg=new Regexp
reg.IgnoreCase=true
reg.Global=false
reg.Pattern=regstr
set Matches=reg.Execute(wstr)
set reg=nothing
i=0
dim body(10)
for each Match in Matches
i=i+1
body(i)=Match.Value
next
RegBody=body(index)
End Function
dim stringbody
stringbody=GetBody("http://www.jswto.com")
stringbody=RegBody(stringbody,"<table.*(?=#996666)(.|\n)*?</table>",1)
response.write(stringbody)
%>
浙公网安备 33010602011771号