内容显示页
 
类别:网络相关 | 浏览(489) | 2007-3-27 17:43:00
<form ><input name=ip    /><input type=submit value="查询IP"></form>
<%
'来源:http://www.yongfa365.com
IP = request("ip")
If IP = "" Then IP = request.servervariables("remote_addr")
url = "http://www.ip.cn/ip.php?q="& IP &""
Body = getHTTPPage(url)

Set Re = New RegExp
Re
.Pattern = "(查询结果:<br><br>[\s\S]+</font><br><br>)"
Set Matches = Re.Execute(Body)
If Matches.Count>0 Then Body = Matches(0)
Re.Pattern = "\[[\s\S]*\]"
Body = Re.Replace(Body, "")

response.Write IP & Body
%>



<%
'函数区

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("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
%>

引用本页地址:http://www.yongfa365.com/item/17b08558443e8c77.html
 
 
相关链接
 
网友评论:
1  rsdfgdf - 2007-12-10 18:57:54
发现任何问题gdfsgdfgdfg您可以:对这此文章进行留言,柳永法会在24小时内给您回复或解决。
 
2 yongfa365 - 2007-12-11 10:36:34
因为ip.cn已经打不开了,所以这段代码就失效了,呵呵
 
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片 看不清? 换张图试试
 
     
 
 
文章分类
 
 
.Net + C#(73)
 
 
ASP+VBS(161)
 
 
 
Linux(10)
 
 
 
web 2.0(26)
 
 
 
 
 
心程(68)
 
生活(97)
 
 
     

Power by :柳永法(yongfa365)'Blog  | 京ICP备07011491号  QQ:64049027  E-mail:64049027@qq.com yongfa365'CodePlex yongfa365'CodeGoogle

申请友情链接 要求:跟本站主题相类似正规网站,双方交换为首页位置

转载请注明来源,以便后人及时得到最新、修正、加强版!!!