title: PHP cURL says Moved Permanently when POSTing to a virtual host
body: <p>I am trying to POST some data with PHP cURL to a local site that's using virtual hosts to have a custom domain <code>http://example.local</code>, but the result seems to be a <code>Moved Permanently</code>. How could I get this to work?</p>
  
  <p>This is my current code:</p>
  
  <pre><code>$url = "http://example.local/paypal_ipn.php"
  $ch = curl_init();
  //set the url, number of POST vars, POST data
  curl_setopt($ch,CURLOPT_URL, $url);
  
  curl_setopt($ch,CURLOPT_POST, substr_count($req,'&amp;')+1);
  curl_setopt($ch,CURLOPT_POSTFIELDS, $req);
  
  //execute post
  $result = curl_exec($ch);
  
  //close connection
  curl_close($ch);
  </code></pre>
  
  <p>I've tried to set <code>CURLOPT_FOLLOWLOCATION</code> as true, but that just follows without the POST data.</p>