tags:

views:

19

answers:

1

I have enabled cookie engine in curl using curl_easy_setopt on CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR.

In the response from server, the cookies are set.

In subsequent requests, CURL is not sending cookies along with the request only if it is a POST request. For GET requests CURL is sending cookies along.

Should I indicate CURL in some other way for POST requests so it would send cookies.

Any help is appreciated.

Thanks, Arun

A: 

CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR are both enough on their own to activate the cookie "engine". However, only CURLOPT_COOKIEFILE will read cookies from a file and only CURLOPT_COOKIEJAR will make any cookies get written to a file.

Your question doesn't really say, but if subsequent requests are using the same easy handle then it will deal with cookies after being enabled.

CURLOPT_VERBOSE and CURLOPT_DEBUGFUNCTION are your friends to better track what headers curl sends and receives.

Daniel Stenberg