Whoa. I wrote jsonip a few months ago and never expected it to get noticed. What a pleasant surprise!<p>Here's the original post with some usage details. <a href="http://news.ycombinator.net/item?id=1896015" rel="nofollow">http://news.ycombinator.net/item?id=1896015</a><p>This is actually running on node.js. If anyone finds a bug or has some suggestions, email me or leave a tweet @geuis.
Some suggestions:<p>Make jsonip.com dual stack IPv4/IPv6 and work for IPv6 addresses too. Return some other useful IP information, such as the PTR, the domain name part of the PTR, and the country code and name.<p>Example: <a href="https://grepular.com/ipinfo" rel="nofollow">https://grepular.com/ipinfo</a><p>EDIT: Don't use that URL for your own stuff or I'll block it. I only put it there as an example of how the JSON should be returned.<p>EDIT2: Might be useful if it included the IP addresses from any X-Forwarded-For HTTP header too.
{ip: "192.168.100.2, xxx.xxx.xxx.xxx"}. Why not change it to {ip: ["192.168.100.2", "xxx.xxx.xxx.xxx"]}?<p>Also, while I don't know any practical use, IPv6 support would be nice.
That's clever and useful. Thanks. I've used <a href="http://checkip.dyndns.org" rel="nofollow">http://checkip.dyndns.org</a> for this problem for years, but this is an improvement. Checkip:<p><pre><code> >>> url = urllib2.urlopen("http://checkip.dyndns.org")
>>> url.read()
'<html><head><title>Current IP Check</title></head><body>Current IP Address: 192.168.0.1</body></html>\r\n'
</code></pre>
Details here: <a href="http://www.dyndns.com/developers/checkip.html" rel="nofollow">http://www.dyndns.com/developers/checkip.html</a><p>It's not as easy to parse as JSON, but nor is it very difficult. The format has not changed in years; I've got a regex running I haven't needed to adjust since day 1.
Great idea by the way! I don't know what for... yet... but great idea! For some reason I have a strange urge to combine this with <a href="http://openkeyval.org/" rel="nofollow">http://openkeyval.org/</a>
if you need geolocation information through javascript, you can use maxmind's free one:<p><a href="http://j.maxmind.com/app/geoip.js" rel="nofollow">http://j.maxmind.com/app/geoip.js</a>
I think I'll replace whatsmyip.com for this: alias whatsmyip="curl -s <a href="http://jsonip.com" rel="nofollow">http://jsonip.com</a> | grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' -o"<p>A simple way of accessing your public IP from bash (for some reason I need to do that a lot!)
<a href="http://myip.wampdeveloper.com/" rel="nofollow">http://myip.wampdeveloper.com/</a><p>Only the ip, no html tags, no formating, nothing but 1 string returned.<p>Also correctly deals with x-forwarded-for and all the other client/proxy/remote header fields.<p>Absolute minimum way of returning an IP address.