< Ruby Programming < Standard Library

OpenURI

OpenURI can be used to download a web page. Ex:

require 'open-uri'
   open("http://www.ruby-lang.org/") {|f|
     f.each_line {|line| p line}
   }

It appears to monkey patch the default "open" method for you, so that it is enhanced to take url's as well as its typical filenames etc.

See also Net::HTTP

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.