Does anyone know of any open RESTful API that I can call to geocode a user's IP to the latitude and longitude?
Ideally, it would be something like: http://google.com/geocode_api/?IP=1.2.3.4 and it would return the latitude and longtitude.
Does anyone know of any open RESTful API that I can call to geocode a user's IP to the latitude and longitude?
Ideally, it would be something like: http://google.com/geocode_api/?IP=1.2.3.4 and it would return the latitude and longtitude.
You could use the google API: http://code.google.com/apis/ajax/documentation/#ClientLocation
Edit
Example:
<script type="text/javascript"
src="http://www.google.com/jsapi?key=ABCDEFG"></script>
<script type="text/javascript">
google.load("maps", "2.x", {callback: initialize});
function initialize() {
if (google.loader.ClientLocation) {
var lat = google.loader.ClientLocation.latitude;
var long = google.loader.ClientLocation.longitude;
alert ("lat: " + lat + "\nlong: " + long);
}
else { alert ("not available"); }
}
Here's a couple with simple calls...
Example calls :-
Example of returned XML (ipinfodb) :-
<Response>
<Ip>122.169.8.137</Ip>
<Status>OK</Status>
<CountryCode>IN</CountryCode>
<CountryName>India</CountryName>
<RegionCode>10</RegionCode>
<RegionName>Haryana</RegionName>
<City>Kaul</City>
<ZipPostalCode></ZipPostalCode>
<Latitude>29.85</Latitude>
<Longitude>76.6667</Longitude>
<Timezone>0</Timezone>
<Gmtoffset>0</Gmtoffset>
<Dstoffset>0</Dstoffset>
</Response>
Hi, if you are looking for real time tracking then you can try XML web service. Try this (http://www.fraudlabs.com/ip2location.aspx) and get their free license key for your lookups. They provide 90 free queries every month. :)