My code creates basic curl handle by curl_init and then sets some options. Then I am using this handle to log-in on some website. I works fine. When I am logged in I would like to access some resources on website that are available only for logged int users. But I want to do it simultanously using curl_multi.
So after logging in I use curl_copy_handle on the handle that I used to log in, I set up new URL for copied handle and add copied handle to curl multi handle.
Then I execute curl multi handle – It works without errors but it can’t access member resources – it seems that curl_copy_handle() doesn’t copy cookies?
How can I copy all cookies (set up during login) along with curl_copy_handle?
I am not pasteing code here because it works ok – I just need method to share cookies with multiple handles.
presuming that you have the correct cookie value, going from the documentation you can use curl_setopt with the CURLOPT_COOKIE value to set them for the request.
curl-setopt function
So just call that on your handle before performing curl_copy_handle. (there’s also CURLOPT_COOKIEFILE to specify a physical cookie you saved.
I haven’t ever used this myself though.