Ruby One-Liner: Download from FTP server through a proxy

Published: 21 Aug 2008

If you need to download a file or view an http page source through a proxy, something like the following one-liner will help:

require 'open-uri'
open("somefile.zip","wb").write(open("ftp://username:password@host:port/remotefile.zip", :proxy=>"http://proxyhost:proxyport").read)