Get Client’s Physical Location from IP Address via GeoMapLookUp.Net

Posted on: July 5th, 2011 by
Comments Requested

It’s becoming more and more popular for sites to tell you where you are. And, aside from being a neat thing to do, it is very useful in honing in onto what your users will find relevant even before the page is loaded. One method of retrieving the browser’s location is through using GeoMapLookUp.Net, however, there are many services out there. Drop down for a list of other location lookup methods.


In a previous post I’ve already described how to get the IP address of a browser using ServerVariables. We’ll use this method here. We’ll also be using a method provided by geomaplookup.net. You can view what this method returns by simply going to http://geomaplookup.net/index.php. Will be using the same url to download an kml file with the addition of ‘?kml=true&ip=‘. Here’s what we need.

XmlDocument doc = new XmlDocument();
WebClient myclient = new WebClient();
string str = myclient.DownloadString(“http://geomaplookup.net/index.php?
kml=true&ip=” + GetIP());
doc.LoadXml(str);

The bulk of the code downloads a kml file from geomaplookup api and loads into into a xml document. The string to call is ‘http://geomaplookup.net/index.php?kml=true&ip=’ with the IP address at the end of the url. You can see what you get as the result by going to that url and inputing any old IP address. You can get yours from WhatIsMyIPAddress.com.

And that’s pretty much it.
Here’s some references for other methods of retrieving the physical location from IP Address.


www.geobytes.com
www.ip2location.com
www.geoiptool.com/


Tags: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>