title: PHP CURL Login with cookie
body: <p>I have a chat service that i would like to make an announcement bot that runs on cron to post daily updates to this chat. The url is <code>http://www6.cbox.ws/box/?boxid=524970&amp;boxtag=7xpsk7&amp;sec=form</code> I have tried various curl examples online but none seem to get the job done. My latest attempt which was a failure.</p>
  
  <pre><code>$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, "http://www6.cbox.ws/box/?boxid=&amp;boxtag=&amp;sec=profile&amp;n=andysmith&amp;k=0000000000000000000000000000000000000000");
  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_REFERER, 'http://www6.cbox.ws/box/?boxid=&amp;boxtag=&amp;sec=profile&amp;n=andysmith&amp;logpword=iloveJD');
  curl_setopt($ch, CURLOPT_COOKIEJAR, 'cbox.txt');
  curl_setopt($ch, CURLOPT_COOKIEFILE, 'cbox.txt');
  curl_exec($ch);
  curl_close($ch);
  </code></pre>
  
  <p>I just need it to login and post a message.</p>