I am testing my site for cURL, and I am trying to make cURL “clear the cache”, so that the session cookie will be regenerated.
So I have an index.php and a login.php.
I do a POST to index with correct credentials and then get as expected a redirect to login.php.
Then, I try to “clear the cache” and cURL to login.php.
I am expecting to get a 302 (redirect) to index.php, but I get a 200 OK…
I am using these settings to try clear the cache:
$cookiefile = "d://cookie.txt";
curl_setopt($curl, CURLOPT_FRESH_CONNECT , 0);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookiefile);
curl_setopt($curl, CURLOPT_FRESH_CONNECT , 1);
Thanks!
If you want to clear the cookies, you should unlink the file
unlink($cookiefile);And after that, you can login again without the old cookie.Good lock.