跑了一下官网文档的 google 例子,结果出现了这样的错误
too many connection resets (due to end of file reached - EOFError) after 0 requests on 14171060, last used 1358139738.5671465 seconds ago (Net::HTTP::Persistent::Error)
源代码是这样的
require 'rubygems'
require 'mechanize'
a = Mechanize.new { |agent|
agent.user_agent_alias = 'Mac Safari'
}
a.get('http://google.com/') do |page|
search_result = page.form_with(:name => 'f') do |search|
search.q = 'Hello world'
end.submit
search_result.links.each do |link|
puts link.text
end
end
求指导。。。