cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: getting cookies from an HTTP request?

From: Drash, Jim [EESUS] <JDrash_at_EESUS.JNJ.com>
Date: Thu, 28 Jun 2001 13:04:51 -0400

You have two cookies!

One is: ASPSESSIONIDQGGQGVQO=PCIIPDMDAEJJNDDOHLICDENI
and the other is: path=/

-----Original Message-----
From: Dan Wood [mailto:djw_lists_at_pacbell.net]
Sent: Thursday, June 28, 2001 12:25 PM
To: curl-library_at_lists.sourceforge.net
Subject: getting cookies from an HTTP request?

I'm trying to use libcurl to get a web page, get the cookie that it gives me
to establish a session, and then use that cookie to get subsequent web
pages. I have found documentation for *setting* a cookie (using
CURLOPT_COOKIE in curl_easy_setopt) but I'm trying to figure out:

* How do you grab the Set-Cookie: header from the result of the HTTP
request? Do I need to parse though the headers myself, or is there some
function for retrieving it for me?

* The Set-Cookie header looks like this:
Set-Cookie: ASPSESSIONIDQGGQGVQO=PCIIPDMDAEJJNDDOHLICDENI; path=/
... so when I send the cookie string with CURLOPT_COOKIE, in the form of
[NAME]=[CONTENTS], is the NAME just the site URL? Do I include or remove the
"path=/" or include that in the CONTENTS?

As you can see, I'm not intimate with how cookies work. Anybody have any
sample code that uses this?

Any help would be greatly appreciated. I feel like I'm missing some vital
concepts here!

-- 
Dan Wood 
dwood_at_karelia.com 
http://www.karelia.com/ 
http://www.bikealameda.org/ 
Mac OS X Developer: Online Resume: http://www.karelia.com/resume.html 
_______________________________________________
Curl-library mailing list
http://curl.haxx.se/libcurl/
Received on 2001-06-28