From: "Jesús Gabriel y Galán" Date: 2010-09-04T03:56:20+09:00 Subject: Re: Read cookie 2010/9/3 Pål Bergström : > Jesús Gabriel y Galán wrote: >> require 'mechanize' >> >> agent = WWW::Mechanize.new >> page = agent.get("http://www.google.com") >> p agent.cookies > > > Got it working when installed as a gem. Thank you so much :-) Don't > understand why I didn't get an answer before. Maybe because your question was not completely clear, and could get confused for someone trying to develop a web application and retreving the cookie in the server that's serving the request. A better question could have been: I am hitting my own website with a script and the server returns a cookie in the response: what's the best way to make the request and read the cookie set by the server? Or something like this :-) > I've asked about this > severeal times. Hopefully I'm on the right track now. > > I do get a cookie. A session cookie. But how do I get a particular > cookie? The cookies method returns an array of cookies, you will have to search for the particular one inside that array: try Array#find method or such. Jesus.