On Mon, Apr 6, 2009 at 5:45 PM, lasitha <lasitha.ranatunga / gmail.com> wrote:
> On Mon, Apr 6, 2009 at 12:23 PM, Tushar Gandhi <gandhi.tush / gmail.com> wrote:
>> Hi,
>>
>> File.copy("http://photos-d.ak.fbcdn.net/photos-ak-snc1/v2574/90/75/704291251/457931_8289306.jpg","/images");
>>
>
> Hello Tushar,
>
> Take a look at 'net/http', which is included in the ruby standard library:
> http://ruby-doc.org/core-1.9/classes/Net/HTTP.html
>
> For example the following code will download and save the ruby logo
> off ruby-lang.org:

Another possibility:

irb(main):001:0> require 'open-uri'
=> true
irb(main):003:0> open("http://www.ruby-lang.org/images/logo.gif") do |f|
irb(main):004:1* File.open("logo.gif", "w"){|out| out.write f.read}
irb(main):005:1> end


Regards,

Jesus.



>
>