Live data from Hacker News

Your IP. In JSON

jsonip.com

51–60 of 72 posts

Re: Your IP. In JSON

#51
post #28

That's clever and useful. Thanks. I've used http://checkip.dyndns.org for this problem for years, but this is an improvement. Checkip: >>> url = urllib2.urlopen("http://checkip.dyndns.org") >>> url.read() ' Current IP Check Current IP Address: 192.168.0.1 \r\n' Details here: http://www.dyndns.com/developers/checkip.html It's not as easy to parse as JSON, but nor is it very difficult. The format has not changed in yea…

You could also use: http://www.whatismyip.com/automation/n09230945.asp

Re: Your IP. In JSON

#54
post #16

Whoa. I wrote jsonip a few months ago and never expected it to get noticed. What a pleasant surprise! Here's the original post with some usage details. http://news.ycombinator.net/item?id=1896015 This is actually running on node.js. If anyone finds a bug or has some suggestions, email me or leave a tweet @geuis.

Node.js - that was my first guess. Nice example of utility computing!

Re: Your IP. In JSON

#56
post #55
post #49

i am missing something here. why does everyone here seem to think this is cool?

Could anyone list some practical uses ?

I built some WebSocket code that calls back to the server. I can't hardcode the "server" ip address because I want to deploy it to different places at different times. Sometimes I'm working on my laptop, sometimes its running on Amazon EC2, etc. So, with something like this I am able to build my Javascript so it always knows how to get back to the server.

Re: Your IP. In JSON

#57

Some suggestions: 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. Example: https://grepular.com/ipinfo 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. EDIT2: Might be useful if it included the…

IPv6 is silly to support. There are no IPv6 NATs, so you should know your IPv6 address.

There shouldn't be IPv6 NATs, but I expect there will be once it actually gets deployed.

Re: Your IP. In JSON

#58
I think I'll replace whatsmyip.com for this: alias whatsmyip="curl -s http://jsonip.com | grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' -o"

A simple way of accessing your public IP from bash (for some reason I need to do that a lot!)

Re: Your IP. In JSON

#60
post #52

if you need geolocation information through javascript, you can use maxmind's free one: http://j.maxmind.com/app/geoip.js

This is perfect. I've been looking for an easy way to find user location (city, state) based on IP address, without having to scrape a IP lookup service for it.

Great find!

Post reply on HN