Retrieve Information using domaintools api

Retrieve network information of computer connected to internet, using iptools xml api.

domaintools provides nice XML file with client network information. One can easily access this file to retrieve the information.

Imports System.Xml
Imports System.IO
Imports System.Net

Public Class Form1
    Dim domainTools As New Dictionary(Of String, String)

    Private Sub retrieveInformation()

        Dim xmlDoc As New XmlDocument

        Dim webRequest As WebRequest = webRequest.Create("http://ip-address.domaintools.com/myip.xml")
        Dim webResponse As WebResponse = webRequest.GetResponse
        Dim webStream As Stream = webResponse.GetResponseStream

        xmlDoc.Load(webStream)

        For Each element As XmlNode In xmlDoc.DocumentElement.ChildNodes
            domainTools.Add(element.Name, element.InnerText)
        Next

        'domainTools dictionary now holds all the information
        'Usage :
        MsgBox(domainTools("ip_address"))

    End Sub

End Class
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s