cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURL and cookiefiles

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 9 Aug 2002 18:49:13 +0200 (MET DST)

On Fri, 9 Aug 2002, Stéphane GRAZIANI wrote:

> I want to use Curlib to retrieve html page with cookies.
> To do it, I use the option CURLOPT_COOKIEFILE.
>
> But in this case, the doc says that, through the command :
> curl_easy_setopt(_handle, CURLOPT_COOKIEFILE , "cookies");
> you create a file name "cookies".

Where does the docs say this? If it really say this, it is an error. It is
not true. COOKIEFILE tells curl to read cookies from the given file name,
and to activate the cookie parser. So given a non-existing file name, it
still activates the cookie parser.

> But when I try it, the file was not created physically on my disk. I want
> to know if there is an option, I miss, to create this file, or if the
> cokies are writte in a stream which is destroyed with the session.

Getting cookies written to disk is enabled with CURLOPT_COOKIEJAR, but do
note that when this is used, the cookies are saved first when
curl_easy_cleanup() is called and not before.

You can also just save the incoming HTTP headers to a file, as
CURLOPT_COOKIEFILE supports reading cookies from either a HTTP header dump
*or* a Netscape/Mozilla-style cookie file.

-- 
 Daniel Stenberg -- curl related mails on curl related mailing lists please
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-08-09