From: Robert Klemme Date: 2009-07-09T16:28:11+09:00 Subject: Re: Get a web page with open-uri 2009/7/8 Andy P. : > Glenn Jackman wrote: >> At 2009-07-08 05:52AM, "Andy P." wrote: >>>  Hello ! >>> >>>  I'm trying to get a web page width open-uri width this code : >>> >>>  require 'open-uri' >>>  open("http://www.google.com") {|src| >>>    open("test.htm","wb") {|dst| >> >> You're looking for the class method in File: >> >>      File.open("test.htm","wb") {|dst| > > > Yes but it don't work with : > open("www.google.com") {|src| > > I'm not trying that in irb, I imported all the files of uri, open-uri, > but it don't work. What is the full name of the open uri method who > creates a TempFile ? > Must I import other files ? Can you show specific code and errors? As for Andrew, this worked for me out of the box: 09:26:33 Temp$ irb19 Ruby version 1.9.1 irb(main):001:0> require 'open-uri' => true irb(main):002:0> open("http://www.google.com") {|src| irb(main):003:1* open("test.htm","wb") {|dst| irb(main):004:2* dst.write(src.read) irb(main):005:2> } irb(main):006:1> } => 5337 irb(main):007:0> exit 09:26:54 Temp$ wc test.htm 9 190 5337 test.htm 09:27:02 Temp$ Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/