Any way to keep curl's cookies in memory and not on disk

前端 未结 6 509
-上瘾入骨i
-上瘾入骨i 2020-12-01 09:09

I\'m doing some cURL work in php 5.3.0.

I\'m wondering if there is any way to tell the curl handle/object to keep the cookies in memory (assuming I\'m reusing the sa

6条回答
  •  春和景丽
    2020-12-01 10:01

    You can use the CURLOPT_COOKIEJAR option, and set the file to "/dev/null" for Linux / MacOS X or "NULL" for Windows. This will prevent the cookies from being written to disk, but it will keep them around in memory as long as you reuse the handle and don't call curl_easy_cleanup().

提交回复
热议问题