多个IP地址查找

时间:2012-11-29 15:02:14

标签: asp.net vb.net ip ip-geolocation

我想知道是否有一个API允许我插入一个由新行分隔的100个或更多IP地址,跟踪它们只需按一下按钮就能检索到它们的信息?目前我正在使用免费的API,但我无法弄清楚它是否可以跟踪多个IP地址,如果是,如何?

以下是API网址:http://www.ipaddressapi.com/

以下是我在其末尾输入IP地址的网址:

http://www.ipaddressapi.com/l/55ffa3e1bb4f123a2e0e21bf30a6731fec615a69b682?h=45.0.0.0

我试过这样做

http://www.ipaddressapi.com/l/55ffa3e1bb4f123a2e0e21bf30a6731fec615a69b682?h=45.0.0.0&47.0.0.0(添加&然后第二个IP地址)但这也不起作用。有什么建议或想法吗?

1 个答案:

答案 0 :(得分:0)

只需执行以下操作:

遍历您的IP地址:

For Each s as String in MyAddresses
    'Add the ip address on the end of the url you wish to get the data for:
    Dim result as string = GetWebPageAsString(New Uri("http://someaddress.com?" + s))
    'parse result however you need to here
Next

将网页作为字符串

的功能
Public Shared Function GetWebPageString(ByVal address As Uri) As String
    Try
        Using client As New Net.WebClient()
            Return client.DownloadString(address)
        End Using
    Catch ex As System.Exception
        Return ""
    End Try
End Function