TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Your IP. In JSON

160 pointsby zcopleyabout 14 years ago

19 comments

geuisabout 14 years ago
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.
评论 #2282700 未加载
评论 #2280257 未加载
mike-cardwellabout 14 years ago
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.
评论 #2279477 未加载
评论 #2279076 未加载
评论 #2279108 未加载
评论 #2279750 未加载
drdaemanabout 14 years ago
{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.
jjguyabout 14 years ago
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> &#62;&#62;&#62; url = urllib2.urlopen("http://checkip.dyndns.org") &#62;&#62;&#62; url.read() '&#60;html&#62;&#60;head&#62;&#60;title&#62;Current IP Check&#60;/title&#62;&#60;/head&#62;&#60;body&#62;Current IP Address: 192.168.0.1&#60;/body&#62;&#60;/html&#62;\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.
评论 #2281605 未加载
评论 #2280049 未加载
hm2kabout 14 years ago
<a href="http://whatismyip.akamai.com/" rel="nofollow">http://whatismyip.akamai.com/</a><p>Pretty reliable.
评论 #2278988 未加载
评论 #2279068 未加载
hunterpabout 14 years ago
While it is minimalist, it would be even more minimalist to just return the ip with no json wrapper.
lurchpopabout 14 years ago
add a jsonp callback option like <a href="http://jsonip.com/?callback=alert" rel="nofollow">http://jsonip.com/?callback=alert</a>
评论 #2278946 未加载
评论 #2280223 未加载
mrspeakerabout 14 years ago
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>
评论 #2279598 未加载
vainabout 14 years ago
i am missing something here. why does everyone here seem to think this is cool?
评论 #2280458 未加载
thereabout 14 years ago
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>
评论 #2282273 未加载
评论 #2280622 未加载
petercooperabout 14 years ago
xmlip.com, yamlip.com, and plaintextip.com are all available, by the way.
floatingatollabout 14 years ago
i see a dancing turtle at kame, but my ipv6 address is not present in the json.
评论 #2278967 未加载
评论 #2279063 未加载
gikraussabout 14 years ago
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!)
powertowerabout 14 years ago
<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.
soulclapabout 14 years ago
What's your business model though?<p>(Kidding.)
billpgabout 14 years ago
Is there an HTTPS service planned? Without it, you may just be seeing the IP of a transparent proxy server.
评论 #2279026 未加载
评论 #2279561 未加载
nphaseabout 14 years ago
Also, icanhazip.com
评论 #2280618 未加载
ptnabout 14 years ago
It got mine wrong.
jparickaabout 14 years ago
Haha .. very cool! :-))