title: PHP login to HTTPS page using Curl
body: <p>I am trying to use php curl function to log in to a https webpage "<a href="https://portal.opalonline.co.uk/Home/PortalCore/SignIn/SignIn.aspx" rel="nofollow">https://portal.opalonline.co.uk/Home/PortalCore/SignIn/SignIn.aspx</a>" </p>
  
  <p>but I have run out of ideas how I can post values to this particular page (username, password) and 'press 'sign in'. </p>
  
  <pre><code>$postfields = array('ctl00_MasterContentContentPane_Signin1_userID_txt'=&gt;'email@address.com', 
              'ctl00_MasterContentContentPane_Signin1_password_txt'=&gt;'somepassword123');
  
  /* LOG IN TO TalkTalk ACCOUNT */
  $ch = curl_init(); 
  curl_setopt($ch, CURLOPT_URL, "https://portal.opalonline.co.uk/Home/PortalCore/SignIn/SignIn.aspx?");   
  curl_setopt($ch, CURLOPT_HEADER, false);
  // curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  
  // curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE); 
  // curl_setopt($ch, CURLOPT_COOKIE, COOKIE_FILE);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
  curl_setopt($ch, CURLOPT_POST, 1);  
  var_dump($ch);
  $string_exec = curl_exec($ch);
  var_dump($string_exec);
  </code></pre>
  
  <p>I can not even display the page with var_dump :( . Ideas / suggestions much appreciated </p>