From: Brian Candler Date: 2010-09-04T05:00:08+09:00 Subject: Re: Read cookie P奪l Bergstr旦m wrote: > It's rails. I used CGI but doesn't seem to work anymore. I just want to > get a value of a cookie with a ruby script in /lib. What about net/http? It's not clear what you want now. Are you writing a web *client* in Ruby - something which initiates a connection to a web server, and sends a HTTP request? (Like a browser) Or a web *server* - something which listens for incoming HTTP requests, and answers them? net/http is something you'd use for the former, and rails is something you'd use for the latter. The cookie interaction is described at: http://en.wikipedia.org/wiki/HTTP_cookie Roughly: * The server includes a "Set-Cookie:" header in a response * The client includes a "Cookie:" header in each subsequent request to the same server When you say you want to "get the value of a browser cookie" it sounds like you're writing something server-side, to extract the cookies sent by the browser. But if you're writing a client using net/http or mechanize, then it's you who *sends* the cookies with each request in the first place. -- Posted via http://www.ruby-forum.com/.