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

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().

Leave a Comment