On Apr 19, 2007, at 8:48 AM, Phillip Gawlowski wrote: > James Edward Gray II wrote: >> On Apr 19, 2007, at 8:10 AM, mrpink wrote: >>> just for fun I wanna share this oneliner which prints you the >>> external IP on the screen :) >>> >>> require 'net/http' >>> >>> Net::HTTP.get_response(URI.parse('http:// >>> www.wieistmeineip.de')).body.scan(/^Ihre IP-Adresse ist.+/) { | >>> ipadresse| puts ipadresse.sub(/^.+">/,'').sub(/<.+$/,'') } >> Interesting. I expected my code to be equivalent, but it gives a >> different answer: >> $ ruby -r resolv -e 'p Resolv.getaddress("http:// >> www.wieistmeineip.de")' >> "212.19.62.76" >> James Edward Gray II > > > If I may translate: the German parts into English: > > > Net::HTTP.get_response(URI.parse('http:// > www.whatismyip.com')).body.scan(/^Your WAN IP is.+/) { |ipadresse| > puts ipadresse.sub(/^.+">/,'').sub(/<.+$/,'') } > > > The one liner resolves your external IP with the help of an > external service. > > A hint for mrpink: German is not widely spoken beyond Germany, > Austria and Swiss, so it's a good idea to translate your output. ;) Wow, I am dumb today. Thanks for helping me to actually read the email I responded to. James Edward Gray II