views:

28

answers:

1

I'm porting over some function using Zend_Http_CookieJar but need some clarification. Presumably the CookieJar only lasts as long as the instance is running. So could I use curl to produce the same thing? :

curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookiefile");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookiefile"); 

So my real question is whether if there were three instances of the script running would their use of the cookiefile clash?

+1  A: 

I don't know from own experience, but I think yes, this could lead to conflicts.

It's probably safest to create a unique cookie jar per process, e.g. using tempnam().

Pekka
I thought so, I know the period it uses it is very short but its definately better to be safe than sorry!
Beaver6813