views:

33

answers:

1

hello there.

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!

A: 

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

Brad F Jacobs
cheers - did that with a htaccess file so the rest of the server stays as is. XML file still not getting through but i think its another problem...
daniel Crabbe