phpcurl向xml属性添加斜杠
尝试使用curl发布一些xml,但它不断向“s”添加斜杠。
我将其发送到我无权访问的服务器,因此无法编码/解码...
$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);
剥离斜杠不起作用?欢迎任何帮助!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您很可能在您的服务器上启用了magic_quotes。这将自动向任何 POST / GET 变量添加斜杠。我会将其关闭并查看是否可以修复它(并在完成后删除
stripslashes
部分)。如果您无权修改 php.ini 或无法在 .htaccess 文件中进行设置,则需要在 POST 变量上进行
stripslashes
,而不是$xmlToPost
代码>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