I am trying to POST some data with PHP cURL to a local site that's using virtual hosts to have a custom domain http://example.local
, but the result seems to be a Moved Permanently
. How could I get this to work?
This is my current 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,'&')+1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $req);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
I've tried to set CURLOPT_FOLLOWLOCATION
as true, but that just follows without the POST data.