cURL / Mailing Lists / curl-library / Single Mail

curl-library

Cookies..

From: Lorenzo Pastrana <pastrana_at_ultraflat.net>
Date: Fri, 13 Sep 2002 12:05:28 +0200

Hi,

I'm trying to use cookies but it seems I'm doing something wrong...

What i would like to do is more or less what a web browser would do : when
cookies are enabled, recieve them cordially and store them for later
retrieval, when needed by a server, go fetch the one is asked for and give
it back properly. Besides I want to do this for an undetermined number of
urls.

In a previous post Daniel saiz :

> 1. you create a cookiejar to store incoming cookies in.
> curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName");

Does this file needs to exist already, or curl will create it on the fly?

> if you then look in /tmp/cookieFileName you will see the cookies that you
> were given by the www.myterminal.com

well, I can't see nothing there... :(
Is there any special condition to be matched for the cookiejar is created ?
Actually I'm reusing the handles for multiple urls so I won't call
curl_easy_cleanup between them, is that the reason ? If it is, how can I use
cookies and persistant connections at the same time ?
Is there a way to force the cookie dump other than curl_easy_cleanup ?

> 5. if you want to use these cookies to go futher around the site you use
> curl_setopt($ch1, CURLOPT_COOKIEFILE, "/tmp/cookieFileName");

What I can't figure out here is : how the cookiejar mechanism would consider
the file, will it be erased before saving so I need a single file per url
(witch is not a problem BTW, and I suspect it is the correct procedure
anyway..) or can I give the same file for every url and proper management
will be done ?

Also, are CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR compatibles on a same
handle so I can feed the server with already stored cookies and eventually
keep track of any possible update / addition ?

> 6. then set the URL & execute

This one should be OK.. ;p

Cheers.
Lo.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-09-13