Can anyone explain the handling of CURL cookies (PHP)?

Honestly, I had trouble understanding the CURL CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR options.

If i installed

curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt') curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt') 

Where is cookie.txt created? On server? In which directory?

And the stupidest question is: does this handle all requests executed by curl-script? So, if I have 200 requests, does CURL store all the request cookie information in one file for all 200 requests?

Maybe someone can give me a quick overview of how this works, I did not find a good tutorial on this, and the documentation is pretty bad.

+1
source share
1 answer

cookie.txt is in the same directory as your PHP script. The cookie.txt is rewritten for each new curl pen.

+1
source

Source: https://habr.com/ru/post/1337151/


All Articles