On 6/3/07, Jonathan Nichols <jnichols / alumni.princeton.edu> wrote:
> Hello,
>
>     I'm trying to use open-uri on yahoo mail's login page.  If I do the
> following:
>
> #!/usr/bin/env ruby
>
> require 'open-uri'
> require 'uri'
>
> f = open("http://mail.yahoo.com")
>
> --------
>
>     I get the following error:
>
> /usr/lib/ruby/1.8/open-uri.rb:174:in `open_loop': redirection forbidden:
> http://mail.yahoo.com/ ->
> https://login.yahoo.com/config/login_verify2?&.src=ym (RuntimeError)
>         from /usr/lib/ruby/1.8/open-uri.rb:132:in `open_uri'
>         from /usr/lib/ruby/1.8/open-uri.rb:528:in `open'
>         from /usr/lib/ruby/1.8/open-uri.rb:30:in `open'
>         from ./readForms.rb:11
>
> -------
>
>     I've tried to use mechanize instead, but I can't seem to figure out
> how to emulate the base_uri functionality in open-uri.  Any ideas?
>
> Regards,
>
> jon

You're being redirected.  Try the redirect url (and you can leave the
?&.src=ym off depending on what you want to do)

require 'open-uri'
document = open( "https://login.yahoo.com/config/login_verify2" ).read