title: CURL Session Management
body: <p>I am building an application that is built upon an API that requires Basic Authentication. I have made many calls and wrapped up the CURL requests inside a class that I've made,</p>
  
  <p>I'm using a cookie jar that I use like this:</p>
  
  <pre><code>curl_setopt($curl_handle, CURLOPT_COOKIEJAR, "cookie.txt");
  curl_setopt($curl_handle, CURLOPT_COOKIEFILE, "cookie.txt");
  </code></pre>
  
  <p>I am trying to keep sessions by using cookie.txt to store the cookies and its been working great. However, today I came across an alarming discovery. When someone else (on a different computer) goes to my app, they can see my session information (probably because it's using the same file as reference for the session). I have thought that perhaps I could generate a new "cookie jar" for each visitor, but this will probably not work when it goes to production. The quantity of users is going to be in the thousands at least, so I think this means that I would need a cookie file for each visit right?</p>
  
  <p>This doesn't seem practical and not to mention that I would have to create the cookie file programmatically. Has anybody else come across this issue before? Any suggestions would be a real help.</p>
  
  <p>Perhaps there's a CURL setopt solution that would uniquely distribute the cookies amongst visits? </p>
  
  <p>Thanks!</p>