Getting a 301 error when trying to php curl -
for first time i've become desperate enough issue sign here. i'm trying write webservice curl others can upload info server. have no influence on code of "customers" , hence url call must must muuuust http://..../update
however, results in "301 - permanently moved" error until add / @ end. adding / simple enough solution if wasn't fact cannot change url. in other words, has work without /
my support team suggested try put redirect in .htaccess , did , add / @ end, still 301. in .htaccess
rewriteengine on rewritebase / rewriterule ^update$ update/ [r]
so, code calls:
error_reporting(e_all); $ch=curl_init(); $url="http://www.virtualairlines.eu/update"; $cleaned_params='(some xml)'; curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $cleaned_params); curl_setopt ($ch, curlopt_returntransfer, true); //curl_setopt($ch, curlopt_followlocation, true); curl_setopt ($ch, curlopt_url, $url); $ret = curl_exec($ch); echo $ret;
as can see tried use followlocation removes posted data , presents me empty page.
this code receives it: (the index.php in update folder)
$data= urldecode(file_get_contents('php://input')); $xml = new simplexmlelement($data);
(there more code isn't relevant)
once put final / in url above, works. again, have no influence on sending end other testing things @ own machine. takers?
Comments
Post a Comment