Getting Started With WWW::Mechanize
require 'rubygems' require 'mechanize' agent = WWW::Mechanize.new page = agent.get('http://google.com/')
Refer to the documentation at http://mechanize.rubyforge.org/mechanize/. Then gem install mechanize, and try running the code in an irb session.
output (extract):
=> #<WWW::Mechanize::Page {url #<URI::HTTP:0xfdbbbb286 URL:http://www.google.com/>} {meta} {title "Google"} {iframes} {frames} {links #<WWW::Mechanize::Page::Link "Images" "http://images.google.com/imghp?hl=en&tab=wi"> #<WWW::Mechanize::Page::Link "Maps" "http://maps.google.com/maps?hl=en&tab=wl"> #<WWW::Mechanize::Page::Link "News" "http://news.google.com/nwshp?hl=en&tab=wn"> #<WWW::Mechanize::Page::Link "Shopping" "http://www.google.com/prdhp?hl=en&tab=wf"> #<WWW::Mechanize::Page::Link "Gmail" "http://mail.google.com/mail/?hl=en&tab=wm">