php curl adding slashes to xml attributes
trying to post some xml with curl but it keeps adding slashes to "s.
开发者_开发知识库I'm sending it to a server i don't hav access so cant encode/decode...
$xmlToPost = '<PurchaseItems DISCOUNT="0" NETLINEVAL="0" PACK_CODE="0" VAT="0" PurchaseOrderNumber="'.$_POST['txn_id'].'">'; // just a snippet!
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://193.128.105.227/sukishufu/externalcom/AddXMLOrder.cfm?ClientSys=sukishufu");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,'ClientUrl=SukuOffice01&OrderXML='.stripslashes($xmlToPost));
$btbResponse = curl_exec($ch);
curl_close($ch);
strip slashes doesn't work? Any help welcome!
You most likely have magic_quotes turned on on your server. This will auto-add slashes to any POST / GET variable. I would turn that off and see if it fixes it (and remove the stripslashes
section when done).
If you do not have access to modify the php.ini or not able to set that in the .htaccess file, you would need to stripslashes
on the POST variable, not the $xmlToPost
精彩评论