title: PHP can't find cookie file after cURL request
body: <p>I'm trying to log into a forum using cURL and save the cookie to a file, then parse the cookie to get the <code>phpbb2mysql_sid</code> cookie. Here's my code thus far:</p>
  
  <pre><code>&lt;?php
  
  $curl = curl_init();
  
  $cookieFile = 'C:\xampp\htdocs\cookies\\' . uniqid(true);
  
  // Login
  curl_setopt($curl, CURLOPT_URL, 'http://localhost/phpbb2/login.php');
  curl_setopt($curl, CURLOPT_COOKIEJAR, $cookieFile);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_HEADER, true);
  curl_setopt($curl, CURLOPT_POST, true);
  $postVars = array('username' =&gt; 'username', 'password' =&gt; 'testing', 'autologin' =&gt; 'on', 'login' =&gt; 'Log in');
  curl_setopt($curl, CURLOPT_POSTFIELDS, $postVars);
  $resp = curl_exec($curl);
  
  // Parse sid from cookie file
  preg_match('/phpbb2mysql_sid\t(.*)/', file_get_contents($cookieFile), $match);
  $sId = $match[1];
  
  echo $sId;
  </code></pre>
  
  <p>However, I'm getting this error when I run the script:</p>
  
  <pre><code>Warning: file_get_contents(C:\xampp\htdocs\cookies\150367764c4ef3) [function.file-get-contents]: failed to open stream: No such file or directory in C:\xampp\htdocs\leech\post.php on line 18
  
  Notice: Undefined offset: 1 in C:\xampp\htdocs\post.php on line 19
  </code></pre>
  
  <p>If I check my filesystem the file is there. And the code to get the file contents is <strong>after</strong> the cURL request, so the file should exist, right?</p>