cURL / Mailing Lists / curl-library / Single Mail

curl-library

getting cookies from an HTTP request?

From: Dan Wood <djw_lists_at_pacbell.net>
Date: Thu, 28 Jun 2001 09:24:32 -0700

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