开发者

Can someone explain CURL cookie handling (PHP)?

开发者 https://www.devze.com 2023-01-23 21:23 出处:网络
honestly I\'m having some trouble understanding the CURL options CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR.

honestly I'm having some trouble understanding the CURL options CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR.

If I set

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

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

And the most stupid question: does this handle all requests the curl-script is executing? So, if I have 200 requests, does CURL store all the request cookie information in a single file for alle 200 requests?

Maybe someone can give me quick overview how this works, I didn't find a good tutorial on this and the documentati开发者_C百科on is quite poor.


cookie.txt is on the same directory as your PHP script. cookie.txt is overwritten for every new curl handle.

0

精彩评论

暂无评论...
验证码 换一张
取 消