The proxy carries the request. PHP cURL's cookie engine decides which destination cookies the client sends. Configure both on the handle performing the transfer. The HTTP proxy list supplies candidates for the route when this workload may use public intermediaries:

curl_setopt($handle, CURLOPT_PROXY, 'http://203.0.113.10:8080');
curl_setopt($handle, CURLOPT_COOKIEFILE, '');

The empty COOKIEFILE value enables the cookie engine without loading an initial cookie file. Subsequent requests on that handle can send matching cookies received from the destination.

For persistence across separately created handles or processes, use a deliberate cookie-file policy. COOKIEFILE reads cookies; COOKIEJAR writes the cookies retained by libcurl. Giving COOKIEJAR a path does not also read it.

Keep cookie files separated by the application's intended session or account. A shared file used by concurrent jobs can mix state independently of which proxy each job selects. Protect the file because a session cookie can grant access even though it is not labelled a password.

If the workflow needs the current cookie state flushed before cleanup, inspect libcurl's documented cookie commands. Do not rely on an outdated PHP example's curl_close call as the only explanation of when state is written.

A changed proxy IP leaves the cookie policy intact unless the application changes it. Diagnose a rejected session as a destination response rather than assuming the proxy is required to remember the login.

Mikanda mikatakata