Forum: Ruby eruby & Mechanize error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2007-04-05 09:00
(Received via mailing list)
Hi,

I am working on a web tool that takes user input and submits this
information to a list of websites like google, yahoo, hotmail etc. It
automates form (e.g login form) submission for these websites using
Mechanize in Ruby.
I have used eruby for the web pages, but when I try to use Mechanize,
the
web page gives error "Temporary failure in name resolution"

<%
    require 'rubygems'
    require 'mechanize'

    agent = WWW::Mechanize.new
    page = agent.get(http://www.google.com)
    form = page.forms[0]
    google_form.q = 'ruby mechanize'
    page = agent.submit(form)
    puts page.body
%>


[Tue Apr 03 14:48:43 2007] [error] mod_ruby:
/usr/local/lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo:
Temporary failure in name resolution (SocketError)
   2902 [Tue Apr 03 14:48:43 2007] [error] mod_ruby:   from
/usr/local/lib/ruby/1.8/net/http.rb:560:in `open'
   2903 [Tue Apr 03 14:48:43 2007] [error] mod_ruby:   from
/usr/local/lib/ruby/1.8/net/http.rb:560:in `connect'
   2904 [Tue Apr 03 14:48:43 2007] [error] mod_ruby:   from
/usr/local/lib/ruby/1.8/timeout.rb:48:in `timeout'
   2905 [Tue Apr 03 14:48:43 2007] [error] mod_ruby:   from
/usr/local/lib/ruby/1.8/timeout.rb:76:in `timeout'
   2906 [Tue Apr 03 14:48:43 2007] [error] mod_ruby:   from
/usr/local/lib/ruby/1.8/net/http.rb:560:in `connect'
   2907 [Tue Apr 03 14:48:43 2007] [error] mod_ruby:   from
/usr/local/lib/ruby/1.8/net/http.rb:553:in `do_start'
   2908 [Tue Apr 03 14:48:43 2007] [error] mod_ruby:   from
/usr/local/lib/ruby/1.8/net/http.rb:542:in `start'
   2909 [Tue Apr 03 14:48:43 2007] [error] mod_ruby:   from
/usr/local/lib/ruby/gems/1.8/gems/mechanize-0.6.5/lib/mechanize.rb:
390:in
`fetch_page'
   2910 [Tue Apr 03 14:48:43 2007] [error] mod_ruby:   from
/usr/local/lib/ruby/gems/1.8/gems/mechanize-0.6.5/lib/mechanize.rb:
160:in
`get'


However if I run the same script from command line, it works fine.

Does somebody know how can I make this work from the web page ?
This topic is locked and can not be replied to.