I'm trying to login to this site using PHP curl commands:
https://users.premierleague.com/accounts/login/
So far my code looks like this
`
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_URL => 'https://users.premierleague.com/accounts/login/',
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36',
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => array(
'login' => 'username',
'password' => 'password',
'app' => 'plfpl-web',
'redirect_uri' => 'https://fantasy.premierleague.com/a/login'
),
CURLOPT_FOLLOWLOCATION => TRUE,
CURLOPT_COOKIESESSION => TRUE,
CURLOPT_COOKIEFILE => $cookie_file_path,
CURLOPT_COOKIEJAR => $cookie_file_path
));
$output = curl_exec($ch);
curl_close($ch);
`
When I run this in a browser though it doesn't login. I get a new cookie file in $cookie_file_path
but no successful login. It just takes prints out the login page html. I've tried analysing things using the networks tab in chrome developer tools, but am none the wiser. I'm guessing it has something to do with a session cookie. Any help much appreciated.