mechanize login form

P

Pen Ttt

i'm gona to simulate login my ubuntu forum,here is my program

require 'rubygems'
require 'mechanize'
agent = Mechanize.new
page =
agent.get('http://forum.ubuntu.org.cn/ucp.php?mode=login&sid=d6179312144b3f8cf843d61b0ba409ca')
uform = page.forms[1]
uform.username = 'ç½—éžé±¼'
uform.password = '*****'
uform.action = 'http://forum.ubuntu.org.cn/ucp.php?mode=login'
page = agent.submit(uform)
page.save('/home/pt/ubuntu')

attention: keyword is absolutely right,here is ommitted.
i found that i haven't longin when i open the file /home/pt/ubuntu
with firefox.
would you mind to tell me what the matter is in my program?
 
J

Josh Cheek

i'm gona to simulate login my ubuntu forum,here is my program

require 'rubygems'
require 'mechanize'
agent =3D Mechanize.new
page =3D
agent.get('
http://forum.ubuntu.org.cn/ucp.php?mode=3Dlogin&sid=3Dd6179312144b3f8cf84= 3d61b0ba409ca
')
uform =3D page.forms[1]
uform.username =3D '=E7=BD=97=E9=9D=9E=E9=B1=BC'
uform.password =3D '*****'
uform.action =3D 'http://forum.ubuntu.org.cn/ucp.php?mode=3Dlogin'
page =3D agent.submit(uform)
page.save('/home/pt/ubuntu')

attention: keyword is absolutely right,here is ommitted.
i found that i haven't longin when i open the file /home/pt/ubuntu
with firefox.
would you mind to tell me what the matter is in my program?
Mechanize has its own set of cookies. So you could be logged in with
Mechanize, and not logged in with Firefox. I found a blog where tenderlove
says you can serialize cookies (
http://tenderlovemaking.com/2006/06/22/new-stuff-in-ruby-mechanize-050/), s=
o
there is probably a way to share them with Fx, but it might take some effor=
t
to find or write, I really don't know.
 

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

Similar Threads

mechanize login problem 1
Mechanize 0
Need Help in Aol Login with mechanize 0
Forms not seen by Mechanize (US Bank login) 2
Problem with Mechanize 2
Mechanize and charset issues 5
mechanize newbie 2
Mechanize 2

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top