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!
1 Answer
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.
6 Comments
Xaqron
+1 for answering the right question. But he says:
the IP Addresses it gets from that webpage which means he needs some networking consultation.user540271
I need the ip's from the page, not the actual websites ip. But thanks for the answer anyway.
Kenny
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.Kenny
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. 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!!
Machinarius
If you are desperate use an XML/HTML parser.... OR ULTIMATELY... use Regex. Read this if you want Regex: stackoverflow.com/questions/1732348/…
|