$ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_COOKIEJAR, 'patch_to_file'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'patch_to_file'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, 'data'); curl_setopt($ch, CURLOPT_URL, 'url'); curl_exec($ch); var_export(unlink('patch_to_file')); //true, но файл все равно присутствует по указанному пути Why is the file in which cookies are written not deleted?
I need to tear down the cookie for further work without closing the curl session.