what-ip.heroku.com simple yet complete API will let your applications know everything about an IP address, from hostname to its geolocation. It is available through HTTP GET requests, free and unlimited.
- Caller (your) IP in JSON: /host.json
- Caller (your) IP in XML: /host.xml
- Caller (your) IP in plain text: /host.txt
- Given IP in JSON: /ip/66.249.92.104.json
- Given IP in XML: /ip/66.249.92.104.xml
- Given IP in plain text: /ip/66.249.92.104.txt
You may provide a callback query string parameter when using JSON to achieve cross-domain requests in web browsers (a technique commonly known as JSONP).
The response will be a JavaScript call to the function whose name was given as callback, with the original JSON object as argument.
Check this example if you're not familiar with this technique.
<script>
function responseReceived(response) {
alert("Your IP Address is: " + response.host.ipv4);
}
</script>
<script src="http://what-ip.heroku.com/host.json?callback=responseReceived"></script>