February 2009
1 post
Excellent Scraping/Form Posting/Mining Mechanize...
WWW::Mechanize examples
Google
require ‘rubygems’
require ‘mechanize’
agent = WWW::Mechanize.new
agent.user_agent_alias = ‘Mac Safari’
page = agent.get(“http://www.google.com/”)
search_form = page.forms.with.name(“f”).first
search_form.q = “Hello”
search_results = agent.submit(search_form)
puts...