PHP & cURL proxy - how to make multi-user cookie jar? PHP & cURL proxy - how to make multi-user cookie jar? curl curl

PHP & cURL proxy - how to make multi-user cookie jar?


Your question has every element of a solution, namely cookie jar and sessions.

When you provide the cookie jar file to CURL simply give it a name according to your user, example:

$protected_cookie_dir='/cookies/';$uid=getUser()->id; // get the user idcurl_set_opt($ch,CURLOPT_COOKIEFILE,$protected_cookie_dir.'file_'.$uid.'.data');curl_set_opt($ch,CURLOPT_COOKIEJAR,$protected_cookie_dir.'jar_'.$uid.'.data');

Important: Be sure to hide that folder (maybe store it outside your document root).