There are 3 files in one folder:
curl.php:
$ch = curl_init('http://localhost/url.php');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_exec($ch);
url.php:
setcookie('test', 'foo', time()+60*60*24, '/');
cookies.txt: (empty)
When I run curl.php
, I expect that cookie will be saved in cookies.txt
.
But nothing happens.
What is wrong with this, why it does not working?