If http://foo.com redirects to 1.2.3.4 which then redirects to http://finalurl.com, how can I use Ruby to find out the landing URL \"h
http://foo.com
1.2.3.4
http://finalurl.com
Another way, using Curb:
def get_redirected_url(your_url) result = Curl::Easy.perform(your_url) do |curl| curl.follow_location = true end result.last_effective_url end