1

What I'm looking to acquire is ip addresses from a webpage which contains the information. Example page: http://www.game-monitor.com I'm basically looking how to make vb.net visit that webpage and save the IP Addresses it gets from that webpage. Thanks!

user540271
  • 11
  • 1
  • 2

1 Answers1

3

Check the System.Net.NetworkInformation for the Ping method. You can ping the hostname and return the IP to a variable.

Dim ping as Ping = New Ping()
Dim pingReply as PingReply = ping.send("www.game-monitor.com")

Dim ip as String = PingReply.Address.ToString()

Edit, you might want to add a try catch in case the ping doesn't get a reply.

ItsPronounced
  • 5,475
  • 13
  • 47
  • 86
  • +1 for answering the right question. But he says: `the IP Addresses it gets from that webpage` which means he needs some networking consultation. – Xaqron Dec 19 '10 at 00:18
  • I need the ip's from the page, not the actual websites ip. But thanks for the answer anyway. – user540271 Dec 19 '10 at 01:16
  • Ahh so there are actual IP addresses on the loaded page? If you know the element's ID that the IP addresses are in (such as DIV, SPAN, or table) then you could use jquery to grab the addresses. Or add `runat="server"` to the element it is stored in and try to get the value server side. Is this site yours? If not the only other way is if the site is serving up the addresses in an API or some type of WebService. – ItsPronounced Dec 19 '10 at 01:20
  • Ok, looking at the site I think I see what you are trying to do. You want to grab a list of server IP's for game servers. I checked the forums and they seem to have an SDK for the site that lets you pull the server info as xml or maybe even HTML. http://www.game-monitor.com/sdk/ I would start in the forums, otherwise you are going to have quite a time parsing a live website for IP addresses. GOOD LUCK!! – ItsPronounced Dec 19 '10 at 01:29
  • If you are desperate use an XML/HTML parser.... OR ULTIMATELY... use Regex. Read this if you want Regex: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – Machinarius Dec 19 '10 at 02:18
  • Well what I've found is that [ class="l" ] appears to be the list of ip's, so now that I know what class their in, is there a way to just get everything in that class to a listbox? – user540271 Dec 22 '10 at 17:28