سؤال

I was wondering if there is an API that will allow me to insert a 100 or more IP addresses separated by a new line, trace them retrieve their info all in one push of a button? At the moment I am using a free API but I cannot figure out if it can trace multiple IP addresses and if so, how?

Here is the API url: http://www.ipaddressapi.com/

and here is the url where I enter the IP address at the end of it:

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

I tried doing it like this

http://www.ipaddressapi.com/l/55ffa3e1bb4f123a2e0e21bf30a6731fec615a69b682?h=45.0.0.0&47.0.0.0 (Adding & then the second IP address) but that didn't work either. Any suggestions or thoughts?

هل كانت مفيدة؟

المحلول

Just do something like the following:

Loop through your ip addresses:

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

A function to get web page as a string

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
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top