title: Send a POST and receive cookies in PHP
body: <p><br />
  I have a website that needs to send a <code>POST</code> to a website, than read the cookies returned (in an HTTP way - aka Set-Cookie: ...)<br />
  I tried this code: <br /></p>
  
  <pre><code>&lt;?php
  $ch = curl_init('http://www.site.co.il/login.php?do=login');
   curl_setopt ($ch, CURLOPT_POST, 1);
   curl_setopt ($ch, CURLOPT_POSTFIELDS, "datadata");
   $a = curl_exec($ch);
   curl_close($ch);
  </code></pre>
  
  <p>but it only loads the website in the browser (without me even writing <code>print($a)</code> !!!) - although it DOES show me 'connect successfully' - but ofcorse doesn't set the cookie.<br />
  I basically want to make a proxy-like application, where the cookies received from <code>site.co.il</code> would be stored on the clients machine, but each time it connects to my site, it will grab the cookies and do a POST to <code>site.co.il</code> with them.<br />
  Any example of grabbing the <code>Set-Cookie:</code> header from the returned HTTP will be appreciated.<br />
  Thank you !</p>