Hello!
Is that possible that with cURL not every user use the same cookie?
Because it's cool that I store the cookie that I get, but this cookie will be used by everybody, and it should be, because it's a login cookie.
Charlie
Hello!
Is that possible that with cURL not every user use the same cookie?
Because it's cool that I store the cookie that I get, but this cookie will be used by everybody, and it should be, because it's a login cookie.
Charlie
Your question is unclear, do you want all user to use the same cookie or not ? What is an user in your case, a visitor on your website ?
In any case, you can set which file curl will use to save/load its cookies using curl_setopt and the CURLOPT_COOKIE* constants.
Here's a really basic overview of how cookies work
Client (browser) makes request
Server sees request and asks "hey, did this client send me a cookie?"
Server doesn't see a cookie, so it does some stuff, and then sends back a response, with a cookie
Client (browser) sees the response and says "hey look, a cookie for me, I better save this"
The next time the client makes a request to that same server, it sends along that same cookie
Server sees the request and asks "hey, did this client send me a cookie?"
Server sees the cookie this time, and does some different stuff because of what's in the cookie, and then sends back a response, with a cookie
Client (browser) sees the response and says "hey look, a cookie for me, lets update the one I have"
It sounds like the problem you're running into is you have multiple curl requests running from the same machine, but you want each one to use a different cookie file.
You should be able to achieve this by using the following two curl options
CURLOPT_COOKIEJAR //tells curl which file to save the cookie from the server in
CURLOPT_COOKIEFILE //tells curl which file to look in and send as the request cookie
If you setup a system so that each different curl request is setting a different path value for these two options, you should be set.