利用Web Service设计IP(主机)地址信息查询程序

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

'作者:wgscd(自由奔腾)@ 2005

记得网上有许多专门搜索Web Service 提供者的站点,可惜我找了半天才找到了http://www.xmethods.com/这个网站,还是很幸运!一看,哇哈多啊,随便找个IP2Location IP Address Geolocation Web Service using SOAP,明白了是可以提供IP查询的WEB Service 马上到http://www.fraudlabs.com/default.aspx注册个KEY(只要E-mail就OK),后到VS.NET2003添加WEB引用http://ws.ip2location.com/ip2locationwebservice.asmx?wsdl 

看提供的方法返回有查询IP,主机的国家,地区,国家,城市,国家代码,域名,纬度,经度,邮编

很好!

代码:

'作者:wgscd(自由奔腾)@ 2005

Dim key As String = "02-E39Y-A27K"'注意自己申请的KEY,这我的

    Dim Input As String =textbox1.txt '记录IP


                Dim IPlocation As com.ip2location.ws.IP2LOCATION


                IPlocation = New com.ip2location.ws.IP2LOCATION

                Dim ws1 As com.ip2location.ws.Ip2LocationWebService

                ws1 = New com.ip2location.ws.Ip2LocationWebService

                IPlocation = ws1.IP2Location(Input, key)

                Me.Text = Input


                If IPlocation.MESSAGE <> "" Then 'if some ERRO

                    Label6.Text = "哎呀!出错了。。"

                    MsgBox(" 错误信息:" & IPlocation.MESSAGE)

                Else 'if no ERRO
         
                    Dim strResult As String = "国家:" & IPlocation.COUNTRYNAME & vbCrLf & "城市:" & IPlocation.CITY & vbCrLf & "国家代码:" & IPlocation.COUNTRYCODE & vbCrLf & "CREDITSAVAILABLE:" & IPlocation.CREDITSAVAILABLE & vbCrLf & "域名:" & IPlocation.DOMAINNAME & vbCrLf & "ISP名:" & IPlocation.ISPNAME & vbCrLf & "纬度:" & IPlocation.LATITUDE & vbCrLf & "经度:" & IPlocation.LONGITUDE & vbCrLf & "地区:" & IPlocation.REGION & vbCrLf & "邮编:" & IPlocation.ZIPCODE & vbCrLf & vbCrLf & vbCrLf & "--wgscd(自由奔腾)@ 2005--"

msgbox(strResult) '结果出来了

运行情况:

下载地址:http://xkec.com/wgscd/exe/IP-Spy.exe

本文关键:利用Web Service设计IP(主机)地址信息查询程序
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top