内容显示页
 
类别:网络相关 | 浏览(227) | 2007-3-27 17:43:00 | 关闭广告
<form><inputname=ip    /><inputtype=submitvalue="查询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>0Then 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")
EndFunction

Function
GetBody(url)
    OnErrorResumeNext
    Set Retrieval = CreateObject("Microsoft.XMLHTTP")
    With Retrieval
        
.Open "Get", url,False,"",""
        .Send
         GetBody
=.ResponseBody
    
EndWith
    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已经打不开了,所以这段代码就失效了,呵呵
 
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片看不清? 换张图试试
 
   
 
 
文章分类
 
   

power by :柳永法(yongfa365)'Blog | model by :hibaidu | css by:众网友 | 京ICP备07011491号   我要统计  

本空间赞助商:北京中科兴联信息技术有限公司

QQ:64049027    E-mail:64049027<at>qq.com