IP Address Geolocation Javascript API : JSON

For one of my project I needed IP geolocation database. While surfing I came to realize that there is a very good database available at iplocationtools.com. This website also provides XML API for this. This API can be accessed found at : IP Location API. However, for this particular project a needed some javascript API. My bad luck I couldn’t find one. So, I myself made that API (using iplocation database), Hope it will help you as well.

Update

The original source is also providing the same service in JSON. So I am shutting down my API and would request you to use the API provided by the IPLocationTools.com

IPlocationTools.com is now IP2Location.com, and they doesn’t provide APIs anymore. As the API provided by me were based on the IPLocationTools.com hence we have also stopped those APIs.

You can see http://www.ip2location.com/developers.aspx to see what are available options.

Moreover you can also see the free stable options available by Google at:

Sorry Guys

47 Responses

  1. Parashuram #

    Should have used YAHOO pipes for the conversion … would have taken the stress off ur server…

    Reply
    • jQuery Howto #

      I just analysed your pipe and it seems it is taking data from iplocationtools.com, which is great. But somehow it is not returning my ip location :( where as Nitin’s server does. Well, I don’t know what might be a problem here :(

      PS. For jQuery adicts, here is jQuery geolocation script.

      Twitter @jqueryHowto

      Reply
      • Willington Vega #

        I’m sorry, I should have written Parashuram instead of Parashuman.

  2. Tim #

    If you’re going to use Google Maps. Why don’t you use the built in IP geolocation that comes with Google’s API?

    Reply
  3. Gesen #

    Wow, this is really nice! Very easy to use.

    Reply
  4. Eric #

    Good job!
    JSON requires object keys and string values to be enclosed in double quotes, intead of single quotes. As far as Javascript is concerned, the result is still a valid object, by it can break other clients using strict JSON parsers.

    Reply
  5. Hao Chen #

    That’s pretty cool. Just wondering, why didn’t you use AJAX (JSON w/ callback) with a library like jQuery?

    Reply
  6. Marc #

    Will add this soon on iplocationtools.com.

    Thanks
    Marc

    Reply
  7. nitin #

    Parashuram, thanks for telling me about Yahoo Pipes. Frankly speaking i didn’t knew about it.

    Tim : I didn’t know that such a functionality exists in GOOGLE Maps. It would be helpful if you could point us to that.

    Thanks Eric for pointing out wrong JSON structure.

    Hao Chen i did it to keep is simple (KISS).

    Marc, We would very much appreciate it.

    Reply
  8. Salih GEDÄ°K #

    Nice work :)

    Reply
  9. brian #

    man.. this is really cool.
    this is what i’ve been looking for. thanks!

    Reply
  10. Kiran #

    Friends , Good that I found this blog. I am using geoplugin get my current location . Copy the following PHP code to server and acess it you will get the current location . But again this is not working in India . I tried for USA,India,Singapore and Australia .It worked for all countries except for India :( . Are yahoo pipes are working for India also to get the current location of the person . If So can any body please provide me a snippet of PHP code that gets me Country,State and City ( for India too) . Thanks for your help.

    Regards
    Kiran

    Reply
  11. Kiran #

    var_export(unserialize(file_get_contents(‘http://www.geoplugin.net/php.gp?ip=’.$_SERVER['REMOTE_ADDR'])));

    Reply
  12. Kiran #

    Thanks Stephen , That really helped me a lot

    Reply
  13. red pepper #

    Geolocalización de IP’s con JSON y Javascript

    Reply
  14. stas17 #

    Одни англичане.ICQ:414293541

    Reply
  15. yasamphani #

    Thanks for the feedback..!!

    Reply
  16. Samuel Lebeau #

    I made a free service dedicated to this purpose: http://my-ip.cc/
    Its API provides a JSONP version so the actual geolocation of your visitors can be available to your JavaScript code without even a roundtrip to your server.
    Currently, it’s using http://hostip.info/ database for IP Geolocation, which is free and quite accurate as anyone can contribute to it, but it might be a good idea to integrate the ip2location service you’re mentionning too…

    Thanks for sharing this !

    Reply
  17. Jack Andolini #

    We are using http://www.IPAddressLabs.com and so far we are very happy. Very accurate, REALLY FAST, and so far (as far as we know) it is verey reliable. No failures, or at least we haven’t detected any in our logs.

    Reply
  18. Skeceiseego #

    ugg boots, drugs whatever send me i order all – ok swell ? here i my adress facts
    htpdvn@yahoo.com

    Reply
  19. Roosevelt #

    I am sure this article has touched all the internet visitors, its really really fastidious piece
    of writing on building up new webpage.

    Reply

Leave a Reply