cannot use cookies in cURL PHP
I used this code snippet to extract the cookie from the server's response:
$returnData = curl_exec($ch);$cookie = '';$pattern = '/Set-Cookie:(.*?)\n/';if (preg_match($pattern, $returnData, $result))$cookie = $result[1];
I've described my experience in this post. This approach doesn't use cookie file.
What concerns cookie file, consider the following advice from http://php.net/manual/en/book.curl.php:
Use absolute path for setting the variables CURLOPT_COOKIEFILE & CURLOPT_COOKIEJAR. To make life easier use the realpath("file.txt") function to get the absolute path.
Try creating the file and give it global read write privilege.
Also try with a relative path (say, ./cookies.txt) instead of an absolute path for the cookie jar file.