[Mechanize-users] adding a cookie

Claudio Belotti bel8 at lilik.it
Tue Feb 6 07:24:51 EST 2007


Hi Aaron,

on 05/02/2007 17:48 Aaron Patterson wrote:
> You're close.  You'll need the URI from the page you want to set the
> cookie with, and the cookie string itself.  Then use the "parse" method
> on WWW::Mechanize::Cookie.  For example:
> 
>   mech = WWW::Mechanize.new
>   page = mech.get('http://localhost/')
>   WWW::Mechanize::Cookie.parse(page.uri,
>     "vhp_js=v1847355112h431970412p;path=/;domain=.venere.com;expire=0") { |c|
>     mech.cookie_jar.add(page.uri, c)
>   }
> Hope that helps.

yes, thank you for your help, now I can login into the site get some
informations and logout I found Mechanize really helpful.

regards
Claudio






More information about the Mechanize-users mailing list