title: IIS PHP 5.5 - HTTP Error 411. The request must be chunked or have a content length
body: <p>I am using PHP in IIS 7.
  Earlier I was having PHP 5.3 it was working fine.
  Now I migrated to PHP 5.5 and I am getting "HTTP Error 411. The request must be chunked or have a content length." error on curl requests.</p>
  
  <p>I was googling the solution but unable to get the any hint.</p>
  
  <p>Below is the sample code which I am using:</p>
  
  <pre><code>    $request = "https://example.com?searchTxt=" . $keyword . "&amp;count=" . $count;
      $data = "[1]";
      $data_encoded = utf8_encode($data);
      // Initialize the session
      $session = curl_init($request);
      // Set curl options
      curl_setopt($session, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_encoded)));
      curl_setopt($session, CURLOPT_POST, 1);
      curl_setopt($session, CURLOPT_POSTFIELDS, $data_encoded);
      curl_setopt($session, CURLOPT_RETURNTRANSFER, TRUE);
      curl_setopt($session, CURLOPT_SSL_VERIFYPEER, 1);
      curl_setopt($session, CURLOPT_SSL_VERIFYHOST, 2);
      curl_setopt($session, CURLOPT_AUTOREFERER, 1); 
      curl_setopt($session, CURLOPT_FAILONERROR, FALSE);
      curl_setopt($session, CURLOPT_USERPWD, USERNAME . ':' . PASSWORD);
      curl_setopt($session, CURLOPT_VERBOSE, TRUE); // Display communication with server
      curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_NTLM ) ; 
      curl_setopt($session, CURLOPT_CAINFO, CERTIFICATE_PATH);
      curl_setopt($session, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
      // Make the request
      $response = curl_exec($session);
  </code></pre>