Curl auto login

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 => '',
                CURLOPT_HEADER => false,
                CURLOPT_FOLLOWLOCATION => true, 
   		CURLOPT_POST => 1,
   		CURLOPT_POSTFIELDS => "name=imtheuser&pass=my%3Apass"

curl_setopt_array($ch, $options);

1 Comment

  1. Maybe the websites uses cookies? So you need to extract the cookies of your loginrequest and send them with your next request(s)…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>