title: Slow execution with POST cURL request
body: <p>I have a cURL request that is giving me a 411 length required error if execute without the Content-Length header. When I add <code>$header[] = 'Content-Length: 0</code> to my array of headers, it is executed slowly (~15sec.). </p>
  
  <p>I use the same code on a different domain without any problem. On this domain, I don't need to set the content-length header and I don't receive a 411 error. I'm thinking the Content-Length error might be related to the issue since only a PUT request should give me this error.</p>
  
  <p>This is my current cURL request:</p>
  
  <pre><code>$curl = curl_init();
  
  $header[] = 'Authorization: Basic 123123';
  $header[] = 'Accept: text/xml';
  //$header[] = 'Content-Length: 0';
  
  curl_setopt($curl, CURLOPT_POST, true);
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
  curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  
  $output = curl_exec($curl);
  $error = curl_error($curl);
  </code></pre>
  
  <p>Edit:
  I've changed my <code>CURLOPT_URL</code> and added <code>CURLOPT_POSTFIELDS</code>.</p>
  
  <pre><code>curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>curl_setopt($curl, CURLOPT_URL, $url . $data);
  </code></pre>
  
  <p>This way I was able to eliminate the need for a <code>Content-Length</code> header but the request is still terribly slow.</p>