# Need Help in Aol Login with mechanize

**URL:** <https://www.ruby-forum.com/t/need-help-in-aol-login-with-mechanize/107063>\
**Category:** Ruby\
**Created:** [June 17, 2007, 3:16pm UTC](https://www.ruby-forum.com/t/need-help-in-aol-login-with-mechanize/107063 "2007-06-17T15:16:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Md.elme\_focruzzaman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@Md.elme\_focruzzaman](https://www.ruby-forum.com/u/Md.elme_focruzzaman)\
**Post date:** [June 17, 2007, 3:16pm UTC](https://www.ruby-forum.com/t/need-help-in-aol-login-with-mechanize/107063/1 "2007-06-17T15:16:48Z")

</div>

Hello There,

## I am tring to develop an aotometed login script for [http://www.aol.com](http://www.aol.com) in ruby.For this purpose I am using mechanize. my code is given bellow:

require ‘rubygems’; require ‘mechanize’

agent = WWW::Mechanize.new  
#agent.user\_agent\_alias = ‘Windows IE 6’  
page = agent.get(‘[http://www.aol.com](http://www.aol.com)’)  
page = agent.get(‘[http://webmail.aol.com](http://webmail.aol.com)’)  
url=page.body[page.body.index(‘[https://my.screenname.aol.com/\_cqr/login/login.psp](https://my.screenname.aol.com/_cqr/login/login.psp)’)…page.body.length]  
url= url[0…url.index(‘"’)-1]  
page=agent.get(url)

frm = page.forms[0]  
frm.loginId=#‘Aol user name’  
frm.password=#‘Aol Password’  
page = agent.submit(frm)  
url =  
page.body[page.body.index(‘[AOL](http://webmail.aol.com/_cqr/LoginSuccess.aspx)’)…page.body.length]  
url=url[0…url.index(“'”)-1]  
puts url

page =agent.get(url)  
puts page.body

* * *

but the the page body is gives me the error page. I think it misses some  
cookies. But I am not so familier with mechanize’s cookie issue. Is the  
any boby who can help me? Please help me with iths issue.

Regards,  
Shuvo.
