From: leon du Date: 2007-09-30T17:17:24+09:00 Subject: how to handle cookie with ruby ------=_Part_3854_21702603.1191140238129 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi all, I dont know how to handle cookie with ruby. the problem is I want to fetch content from a website which need login first. I use the http.post to do the login and seemed works well, but when I went to the index page, still I got the login first message. so, any suggestions? ---------------------below is my code--------------------------- require 'net/http' require 'cgi' require 'iconv' def fetch_content Net::HTTP.start ('domain' ) do |server| id = CGI.escape("id" ) passwd = CGI.escape("pw" ) params = "id=#{id}&pwpwd=#{passwd}" resp = server.post2('/login.php?' , params,headers) # I got a 200 OK, the resp.body shows that the login is successful params = "" resp = server.post2('/index.php' , params,headers) # after checking the resp.body , the index page still says I need to login end end ------=_Part_3854_21702603.1191140238129--