www.gusucode.com > 山寨版广告信息招贴网源码程序 > 山寨版广告信息招贴网源码程序/ewuyi/dir_发布/info/ips.asp

    <!-- #include file="../Inc/Checkurl.asp"-->
<%
response.expires = -1
response.addheader "cache-control","no-cache"
Response.AddHeader "Pragma","no-cache"
wd=Request("ip")
If Request("ip")<>"" Then
ips="http://ip38.com/index.php?ip="&wd
End If
TempStr= getHTTPPage(ips)
dim ipso
set reg=new Regexp
reg.Multiline=True
reg.Global=Flase
reg.IgnoreCase=true
reg.Pattern="<h3>((.|\n)*?)</h3>"
Set matches = reg.execute(TempStr)
For Each match1 in matches
ipso=match1.Value
Next
Set matches = Nothing
Set reg = Nothing
ipso=Replace(ipso,"找到相关网页","")
If ipso="" Then ipso="IP地址查询失败"%>
<%=ipso%>
<%
Function getHTTPPage(Path)
 t = GetBody(Path)
 getHTTPPage=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("ado"&"db.str"&"eam")
 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
%>