From: Josh Cheek Date: 2010-06-16T16:22:42+09:00 Subject: Re: mechanize login form --0016e65b5c5036107b04892096f6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Jun 16, 2010 at 12:18 AM, Pen Ttt wrote: > 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? > -- > Posted via http://www.ruby-forum.com/. > > 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. --0016e65b5c5036107b04892096f6--