Ok, I've tried a various scripts that I found and none of them worked. I'm interested why very basic PHP Curl scripts are not working? Is it about XAMPP? Here is, for example, my code
$ckfile = $_SERVER['DOCUMENT_ROOT'] .'/cookies' . '/cookies.txt';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://example.com/"); // of courese, have cookies
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
curl_exec($ch);
curl_close($ch);
which should return cookies in my cookies.txt file. Why is this not happening? Notices: Ownership is not problem (I have tried with different) Permissions is not problem (made 777) Checked file_exists($ckfile), file exists.
I found the reason. No one mentioned that besides ownership, permissions, full path and so, cookie you trying to save to local file must be server side cookie, not the cookies set by javascript.
Hopes someone will find this helpful.