From: 7stud -- Date: 2008-01-28T13:24:20+09:00 Subject: Re: Extracting Data from a Webpage William James wrote: >> I was wondering if anyone knew a way to extract the web page title off >> of a specific URL that you input into a program? > > require 'net/http' > puts Net::HTTP.new('www.google.com').get('/'). > body[/(.*?)<.title>/i,1] Nice. I tested your code and it works for me. But my reading of the docs says that it shouldn't work: new() doesn't open a connection, and get(), "Gets data from path on the connected-to host." The docs seem to want you to do something like: resp_obj = Net::HTTP.get_response('http://www.google.com', '/index.html') page = resp_obj.body -- Posted via http://www.ruby-forum.com/.