I implemented the following code for automatic login and set session using cURL. It will not authenticate. Please explain to me how Laravel authentication using PHP cURL works.
$url = 'http://localhost/site/login'; (Laravel Login URl)
$username = 'xxx@xxx.com';
$password = 'password';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
I am getting the
419 Sorry, your session has expired
How do I pass Laravel CSRF token using cURL in same domain between core PHP and Laravel?