I have a PHP script which uses CURL to log into a site with a simple login page. It sends an initial request to the site and sees if it\'s already logged in (due to cookies)
The first you must make sure __DIR__
have write permission.
The second when you run code. You can check cookie.txt
file had been create or not.
The third you must use ONE cookie for all session. So the victim know you logged in.
And try my source
$cookies = tempnam('/tmp','cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);