Advertisement
Guest User

GeoIP Vb.net and XML

a guest
Jun 27th, 2012
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. Imports System.Xml
  2. Public Class frmMain
  3. ''' <remarks>Feel free to use this codes but please give credit where it's due. I've spent a lot of time on this..lol
  4. ''' and I'm sharing it with the world for free. What I'm really trying to say is Don't steal my shit and claim it's yours.
  5. ''' coded by Ch4ng3m3</remarks>
  6. Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  7. geoip()
  8. End Sub
  9. Private Sub geoip()
  10. Dim xmldoc As New XmlDocument
  11. Dim xmlnode As XmlNodeList
  12. Dim i As Integer
  13. xmldoc.Load("http://freegeoip.net/xml/" & TextBox1.Text)
  14. xmlnode = xmldoc.GetElementsByTagName("Response")
  15. For i = 0 To xmlnode.Count - 1
  16. xmlnode(i).ChildNodes.Item(0).InnerText.Trim()
  17. Label1.Text = "IP Address : " & xmlnode(i).ChildNodes.Item(0).InnerText.Trim()
  18. Label2.Text = "Country Code : " & xmlnode(i).ChildNodes.Item(1).InnerText.Trim()
  19. Label3.Text = "Country Name : " & xmlnode(i).ChildNodes.Item(2).InnerText.Trim()
  20. Label4.Text = "Region Code : " & xmlnode(i).ChildNodes.Item(3).InnerText.Trim()
  21. Label5.Text = "Region Name : " & xmlnode(i).ChildNodes.Item(4).InnerText.Trim()
  22. Label6.Text = "City : " & xmlnode(i).ChildNodes.Item(5).InnerText.Trim()
  23. Label7.Text = "Zip Code : " & xmlnode(i).ChildNodes.Item(6).InnerText.Trim()
  24. Label8.Text = "Latitude : " & xmlnode(i).ChildNodes.Item(7).InnerText.Trim()
  25. Label9.Text = "Longitude : " & xmlnode(i).ChildNodes.Item(8).InnerText.Trim()
  26. Label10.Text = "Metro Code : " & xmlnode(i).ChildNodes.Item(9).InnerText.Trim()
  27. Next
  28. End Sub
  29. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement