I wrote a WordPress widget for displaying some fuel prices in my sidebar. Now I want to let it update some fuel websites if the prices change. The following piece of code should log me in but it doesn’t work for whatever reason. I have no idea what’s going wrong
$ch = curl_init();
$options = array(
CURLOPT_URL => 'http://www.clever-tanken.de/login.asp',
CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => "name=imtheuser&pass=my%3Apass"
);
curl_setopt_array($ch, $options);
curl_exec($ch);
curl_close($ch);
Maybe the websites uses cookies? So you need to extract the cookies of your loginrequest and send them with your next request(s)…