require 'open-uri' f = open('http://www.rubyinside.com/test.txt') puts "The document is #{f.size} bytes in length" f.each_line do |line| puts line end