9 ms·
Your IP. In JSON
- 9ec4c12949a4f3 16y agoI can't be the only one who is wondering but... what's exactly impressive about this?
- jparicka 16y agoHaha .. very cool! :-))
- lurchpop 16y agoadd a jsonp callback option like http://jsonip.com/?callback=alert http://jsonip.com/?callback=alert
- rburgt 16y agoits there already: http://jsonip.com/nameofcallbackfunction http://jsonip.com/nameofcallbackfunction
- qixxiq 16y agoYou should probably include the ?callback= functionality anyway. A great deal of libraries assume it will be a get variable, and cater for it specially i.e. jQuery with http://jsonip.com/?callback= http://jsonip.com/?callback=?
- NovaDesu 16y agoI actually made something like this a while ago. http://demontunes.com/api/?g=ip http://demontunes.com/api/?g=ip // plain ip http://demontunes.com/api/?g=ip&format=json http://demontunes.com/api/?g=ip&format=json // in json http://demontunes.com/api/?g=ip&format=json&callback=hello http://demontunes.com/api/?g=ip&format=json&callback... // with a callback
- rburgt 16y agoyour absolutely right, but I did not make jsonip.com If you are using a framework for this, most of the time you are able to override callback function name, i.e. jQuery uses jsonpCallback : http://api.jquery.com/jQuery.ajax/ http://api.jquery.com/jQuery.ajax/ If not, load it manually as a script and generate a function for the callback.
- clarkevans 16y agoFor most modern browsers, you don't need JSONP if you set the Cross-Origin Resource Sharing header, http://www.w3.org/TR/cors/ http://www.w3.org/TR/cors/
- floatingatoll 16y agoi see a dancing turtle at kame, but my ipv6 address is not present in the json.
- JoachimSchipper 16y agoWell, yes - jsonip.com has no AAAA records. I'm not sure that reporting (only! - it only knows where the connection is from) an IPv6 address is all that useful, either. That said, there's space for a jsonip6.com...
- enneff 16y ago"I'm not sure that reporting [only] an IPv6 address is all that useful" Why not? It's useful to me, and anyone else who has an IPv6 address. The future is now. Get with the program.
- maggit 16y agoI'm not in the future yet, but I was under the impression that with IPv6 you would actually know your own public address, because there is no need for NAT. Is this not correct?
- mryall 16y agoNot only do you know it, you get it tattooed on your body. If there's no need to change IP addresses, you might as well make it permanent.
- JoachimSchipper 16y agoIPv6 addresses are statically allocated (well, in the IPv6 proponents' designs - in reality, we may end up with DHCPv6 and the like), but almost always provider-allocated (PA), not provider independent (PI); so you'll have to give it back to your ISP when you switch. This is a good thing, by the way; PI space consumes memory on the backbone routers (they can't just send it to your ISP, after all - the whole point is that you can take it with you). Of course, PA space is just part of a larger allocation to your provider. In other words, don't get the tattoo.
- petercooper 16y agoxmlip.com, yamlip.com, and plaintextip.com are all available, by the way.
- billpg 16y agoIs there an HTTPS service planned? Without it, you may just be seeing the IP of a transparent proxy server.
- pmjordan 16y agoHTTPS can be proxied, too, transparent or not, and you'll end up with the proxy's IP. (as the HTTP headers are encrypted along with everything else, the proxy can't even include an 'X-Forwarded-For:' header) Still useful for maintaining the full 'lock' icon when embedding in other websites, though including jsonp in an https site somewhat defeats the purpose. You'd need CORS on the server for it to be useful.
- billpg 16y agoAn HTTPS proxy can only work when the client explicitly configures it. A proxy that can't cache or modify traffic is more like a NAT router than a proxy. (I imagine getting the IP of the other side of any NAT router is point of this service.)
- pmjordan 16y agoYou can transparently proxy arbitrary network traffic. See https://github.com/apenwarr/sshuttle https://github.com/apenwarr/sshuttle for an example. FWIW, I'm only pointing out that HTTPS wins you exactly nothing compared to HTTP for this particular purpose. The concept of the "correct" IP address in the context of NAT and proxies is hazy at best anyway.
- billpg 16y agoThere are ISPs that will route all (or some) port 80 traffic into a bank of caching proxies but route traffic for all other ports normally. (GRC.COM's 'Shields Up' service makes a point of using HTTPS to make sure it's testing your external IP rather than a random proxy server.) I suppose it depends on what you actually want to use the returned IP for. As you say, the concept is hazy.
- 16y ago
- hm2k 16y agohttp://whatismyip.akamai.com/ http://whatismyip.akamai.com/ Pretty reliable.
- IsaacSchlueter 16y agoParsing text is too hard. It'd be easier if it was in JSON.
- deleted 16y ago[deleted]
- mrspeaker 16y agoGreat 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 http://openkeyval.org/ http://openkeyval.org/
- apgwoz 16y agoOpenkeyval is kind of cool except that it uses Memcache as the storage platform--i.e. no guarantees of persistance.
- geuis 16y agoWhoa. 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 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.
- mike-cardwell 16y agoSome 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 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 IP addresses from any X-Forwarded-For HTTP header too.
- geuis 16y agoThanks Mike. I'll start working some of these in over the next few days
- gmac 16y agoSome of this is already available elsewhere: I've been using http://ipinfodb.com/ http://ipinfodb.com/ to decide whether to show a region-specific alert on the front page of http://mappin.es http://mappin.es
- sghael 16y agoThis brings up something I'm waffling on. Whats the correct content type for JSON? in your example returning "Content-Type: text/plain; charset=UTF-8" which is nice because FF knows to render it in the browser (good for debugging atleast). But votes on SO seem to indicate it should be "application/json" http://stackoverflow.com/questions/477816/the-right-json-content-type http://stackoverflow.com/questions/477816/the-right-json-con...
- dugmartin 16y agoUse application/json plus the JSONView Firefox plugin to get nice pretty printed json output.
- amitraman1 16y agoapplication/json
- alanh 16y ago
- drdaeman 16y ago{ip: "192.168.100.2, xxx.xxx.xxx.xxx"}. Why not change it to {ip: ["192.168.100.2", "xxx.xxx.xxx.xxx"]}? Also, while I don't know any practical use, IPv6 support would be nice.
- jjguy 16y agoThat's clever and useful. Thanks. I've used http://checkip.dyndns.org http://checkip.dyndns.org for this problem for years, but this is an improvement. Checkip: >>> 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' Details here: http://www.dyndns.com/developers/checkip.html 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 years; I've got a regex running I haven't needed to adjust since day 1.
- callahad 16y agoYou could also use: http://www.whatismyip.com/automation/n09230945.asp http://www.whatismyip.com/automation/n09230945.asp
- pavel_lishin 16y agoWhat a convenient URL to remember.
- spicyj 16y agoFor a while, http://whatismyip.org/ http://whatismyip.org/ returned your IP in plain text, but no longer.
- deleted 16y ago[deleted]
- electrum 16y agoTry this: http://myip.dnsomatic.com/ http://myip.dnsomatic.com/ Documented here: http://dnsomatic.com/wiki/api#detecting_changes http://dnsomatic.com/wiki/api#detecting_changes
- ssdghjyt 16y agoClick on our website: ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ Website wholesale various fashion shoes, such as Nike, Jordan, prada, also includes the jeans, shirt, bags, hats and decoration. Personality manufacturing execution systems (Mes) clothing, Grab an eye bag coat + tide bag Air jordan(1-24)shoes $30 Handbags(Coach l v f e n d i d&g) $35 Tshirts (Polo ,ed hardy,lacoste) $15 Jean(True Religion,ed hardy,coogi) $30 Sunglasses(Oakey,coach,gucci,A r m a i n i) $15 New era cap $12 Bikini (Ed hardy,polo) $20 accept paypal and free shipping ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯
- ssdghjyt 16y agoClick on our website: ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ Website wholesale various fashion shoes, such as Nike, Jordan, prada, also includes the jeans, shirt, bags, hats and decoration. Personality manufacturing execution systems (Mes) clothing, Grab an eye bag coat + tide bag Air jordan(1-24)shoes $30 Handbags(Coach l v f e n d i d&g) $35 Tshirts (Polo ,ed hardy,lacoste) $15 Jean(True Religion,ed hardy,coogi) $30 Sunglasses(Oakey,coach,gucci,A r m a i n i) $15 New era cap $12 Bikini (Ed hardy,polo) $20 accept paypal and free shipping ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯ ╭══════════════╮ http://simurl.com/voblec http://simurl.com/voblec ╰══════════════╯
- nphase 16y agoAlso, icanhazip.com
- burke 16y agoI'll probably start using this one. Nice short domain name.
- powertower 16y agohttp://myip.wampdeveloper.com/ http://myip.wampdeveloper.com/ Only the ip, no html tags, no formating, nothing but 1 string returned. Also correctly deals with x-forwarded-for and all the other client/proxy/remote header fields. Absolute minimum way of returning an IP address.
- hunterp 16y agoWhile it is minimalist, it would be even more minimalist to just return the ip with no json wrapper.
- vain 16y agoi am missing something here. why does everyone here seem to think this is cool?
- cake 16y agoCould anyone list some practical uses ?
- Corrado 16y agoI 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. <yea, I know there are lots of ways to do this, but this is the one I chose. :) sue me. >
- Tichy 16y agoSo myipinjosin returns the server's IP address? I thought it would return the clients IP address. (Link is broken atm). For your use case, relative URLs seem the better solution?
- joebananas 16y agoFinding your own external, visible-to-the-internet IP. You're almost always behind some router these days, so using ifconfig or whatever is pretty useless.
- ptn 16y agoIt got mine wrong.
- there 16y agoif you need geolocation information through javascript, you can use maxmind's free one: http://j.maxmind.com/app/geoip.js http://j.maxmind.com/app/geoip.js
- pedrocr 16y agoOutputting javascript code instead of something parseable (json probably) seems like a very bad idea. Are you really willing to eval code from a site outside your control? A simple line-by-line regex loop should be enough to parse this though.
- innes 16y agoThis, I think: http://en.wikipedia.org/wiki/JSON#JSONP http://en.wikipedia.org/wiki/JSON#JSONP Under the same origin policy, a web page served from server1.example.com cannot normally connect to or communicate with a server other than server1.example.com. An exception is the HTML <script> element.
- cappaert 16y agoThis 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!
- gikrauss 16y agoI think I'll replace whatsmyip.com for this: alias whatsmyip="curl -s http://jsonip.com 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!)
- soulclap 16y agoWhat's your business model though? (Kidding.)