From: Bill Kelly Date: 2002-10-31T05:51:30+09:00 Subject: Re: get index.htm and read it out Hi, From: "Tom Stone" > Hi, > I found this code the pragmatic programmers book. > require 'net/http' > > h = Net::HTTP.new('www.pragmaticprogrammer.com', 80) > resp, data = h.get('http://www.pragmaticprogrammer.com/index.html', nil) > if resp.message == "OK" > data.scan(/ end > > So I copied this code and tried to execute it with the ruby interpreter. But > it didn't work. It just displays an errror message "private method scan > called for nil". Does anyone have a suggestion why this does not work? > Thanks Pasting lines from your email above into irb worked OK for me here (ruby 1.6.6 (2001-12-26) [i586-mswin32]). irb> require 'net/http' true irb> h = Net::HTTP.new('www.pragmaticprogrammer.com', 80) # irb> resp, data = h.get('http://www.pragmaticprogrammer.com/index.html', nil) [#, " [......long string elided.....] irb> resp.message == "OK" true irb> data.scan(/