&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Two days ago want to write a section with IP reverse domain name code, in many sites for a long time, and finally in an English station can be seen through live.com search results extracted such information, so wrote the following paragraph: The program is only successful test, did not optimize, query efficiency a bit low!
<%
Dim strpage
Function GetPage2 (Path)
t = GetBody (Path)
Getpage2=bytestobstr (T, "GB2312")
End Function
Function getbody (URL)
On Error Resume Next
Set retrieval = CreateObject ("Microsoft.XMLHTTP")
with retrieval
. Open "Get", url, False, "", "
. Send
getbody =. Responsebody
End With
Set retrieval = 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 = no
end Function
Public Function GetDomain (TEMPSTR,MATCHSTR)
Set Reg=new Regexp
Reg. Multiline=true
Reg. Global=true
Reg. Ignorecase=true
Reg. Pattern=matchstr
Set matches = Reg.execute (TEMPSTR)
For the match in matches
If not InStr (Getdomain,match. Value) >0 Then
Getdomain=getdomain&match. Value
End If
Next
End Function
Dim i
For I=1 to 15
Strpage=strpage&getpage2 ("http://cnweb.search.live.com/results.aspx?q=ip%3A59.54.54.167&first=" &i & "1")
Next
Strpage=getdomain (Strpage, "<cite>") \/")
Strpage=replace (Strpage, "<cite>", "<li class=classli>")
Strpage=replace (Strpage, "</", "</")
Strpage=replace (Strpage, "/", "</li>")
Strpage=replace (Strpage, "<<", "<")
Strpage=getdomain (Strpage, "<li") \/li> ")