cURL cookie negative cookie expire
- by Joe Doe
I have problems with cookies with cURL.
After problems I turned on verbose function and figured out cURL sets them negative expire date even if server sends positive date.
Example:
* Added cookie _c_sess=""test"" for domain test.com, path /, expire -1630024962
< Set-Cookie: _c_sess="test"; Domain=test.com; HttpOnly; expires=Mon, 26-Mar-2012 14:52:47 GMT; Max-Age=1332773567; Path=/
As you can see both expires and max-age are positive, but cURL sets expire to negative value.
Somebody has idea?
EDIT:
Here is php code I use.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://site.com/");
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0');
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiepath);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiepath);
curl_setopt($ch, CURLOPT_HEADER ,1);
curl_setopt($ch, CURLOPT_VERBOSE ,1);
curl_setopt($ch, CURLOPT_STDERR ,$f);
curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$data = curl_exec($ch);
Data from cookie jar:
#HttpOnly_.test.com TRUE / FALSE -1630016318 _test_sess "test"