Curl: Multiple Cookies Curl: Multiple Cookies curl curl

Curl: Multiple Cookies


If they're seperate computers, then it's seperate file systems and each will have its own cookie file.

But if you're on shared storage, then use a dynamic filename, perhaps

'cookie-' . $_SERVER['SERVER_NAME'] . '.txt'

instead, which'd give you

cookie-ComputerA.txt    cookie-ComputerB.txt    etc...


You could hash the IP that the request comes from and add that to the filename. This would work unless both computers have the same public IP.


You can use a unique identifier to uniquely identify user. User id, session ID or IP address may be a good choice:

$user_id = get_user_id_from_somewhere();curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie-".$user_id.".txt");curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie-".$user_id.".txt");