title: Can't connect to HTTPS site using cURL. Returns 0 length content instead. What can I do?
body: <p>I have a site that connects using cURL (latest version) to a secure gateway for payment.</p>
  
  <p>The problem is cURL always returns 0 length content. I get headers only. And only when I set cURL to return headers. I have the following flags in place.</p>
  
  <pre><code>curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  curl_setopt($ch, CURLOPT_URL, $gatewayURI);
  curl_setopt($ch, CURLOPT_HEADER, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt ($ch, CURLOPT_POST, 1);
  </code></pre>
  
  <p>The header returned is</p>
  
  <pre><code>HTTP/1.1 100 Continue
  
  HTTP/1.1 200 OK
  Date: Tue, 25 Nov 2008 01:08:34 GMT
  Server: Microsoft-IIS/6.0
  X-Powered-By: ASP.NET
  Content-Length: 0
  Content-Type: text/html
  Set-Cookie: ASPSESSIONIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; path=/
  Cache-control: private
  </code></pre>
  
  <p>I have also tried cURL'ing different sites and they return content fine. I think the problem might have something to do with the https connection.</p>
  
  <p>I have spoken with the company and they are unhelpful.</p>
  
  <p>Has anyone else experienced this error and know a work around? Should I ditch cURL and try and use <code>fsockopen()</code> ?</p>
  
  <p>Thank you. :)</p>