title: php cURL cookie saving empty
body: <p>I have made a successful connection using cURL, but I trying to download a file and its not working. I know it's the cookie because when I open the downloaded file, it contains an authorized required message. The initial authentication is working though. any thoughts</p>
  
  <pre><code>// Create a curl handle to a non-existing location
  $ch = curl_init('https://xxxx/');
  
  
  // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  
  
  // ENABLE HTTP POST
  curl_setopt ($ch, CURLOPT_POST, 1);
  
  // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
  curl_setopt ($ch, CURLOPT_POSTFIELDS, 'user=xxx&amp;password=xxx');
  
  // IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
  curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
  curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  
  
  
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  
  $fp = fopen("status.xml", "w");
  
  curl_setopt($ch, CURLOPT_FILE, $fp);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  
  
  if(curl_exec($ch) === false)
  {
      echo 'Curl error: ' . curl_error($ch);
  }
  else
  {
      echo 'Operation completed without any errors';
  }
  
  
  curl_close($ch);
  
  
  fclose($fp);
  </code></pre>