title: cookiejar in PHP Curl
body: <p>In PHP Curl case when we need to store/read cookies in term of web scraping, it feels that many resources out there encourage to use a file for handling cookies with these option</p>
  
  <pre><code>curl_setopt($ch, CURLOPT_COOKIEJAR, $CookieJarFilename);
  
  curl_setopt($ch, CURLOPT_COOKIEFILE, $CookieJarFilename);
  </code></pre>
  
  <p>The bottom line here is they use a single file as cookiejar (usually .txt file).</p>
  
  <p>But in the real scenario, our website is not only accessed by one computer, most likely there are many computers accessed it in the same time, and also there are some bots like Googlebots, Yahoo Slurp, etc.</p>
  
  <p>So, with the <strong>single .txt</strong> file, isn't it obvious that the cookie jar will overwrite the same text file, make it a real mess for cookie?</p>
  
  <p>Or am I mistaken here?</p>
  
  <p>What's the 'right' method for handling cookies?</p>