Need Help in Aol Login with mechanize

  • Thread starter Md.elme focruzzaman Shuvo
  • Start date
M

Md.elme focruzzaman Shuvo

Hello There,

I am tring to develop an aotometed login script for 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')
page = agent.get('http://webmail.aol.com')
url=page.body[page.body.index('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('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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top