IP Address Geocoding is getting more and more popular with people who are building their own analytics tools or want to track their users. There are a lot of free geocoding web services available which can return the geocoded data in text, XML or JSON format, the most popular ones being http://freegeoip.net, http://ipinfodb.com, http://www.hostip.info,http://www.maxmind.com and many others. Geocoded data from these website can be easily accesses by using any server side scripts, but I wanted to build a JavaScript based solution which only works using asynchronous AJAX calls. For this API I used a free web service provided by http://freegeoip.net/ which returns data in XML(http://freegeoip.net/xml/) or JSON(http://freegeoip.net/json/) format. As the browsers only allow JSONP data to be returned back from cross-domain AJAX calls, I had to use another free service from http://jsonpify.com/ to convert the geocoded JSON data to JSONP format.
This API uses Google Map Api to display map and geotag the IP Address. You will have to sign up for Google Map API if you haven't already done for your domain.
For demo and more information on how to use this API, please visit my lab page at:
http://lab.abhinayrathore.com/ipmapper/
http://lab.abhinayrathore.com/ipmapper/
Please drop a comment below if you like this API or have any modifications or improvements.
No comments:
Post a Comment