phpcurl向xml属性添加斜杠

发布于 2024-09-17 10:22:24 字数 595 浏览 3 评论 0原文

尝试使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

音盲 2024-09-24 10:22:24

您很可能在您的服务器上启用了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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文