在过去的两周里,我一直在学习cxml。一开始很可怕。但最终会变得更容易。因此,我终于能够成功地使用一个跳出设置请求,这将返回开始URL。我可以浏览供应商的网站,并添加到购物车。
现在我需要把购物车里的物品转移到我的页面上。在跳出设置请求中,我必须提供该URL的URL。当我点击转移车,供应商网站将重定向我到mypage。现在,我如何在PHP中解析甚至获取输出订单消息。
如下所示,朋choutorderMessage应该是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">
<cXML timestamp="2019-05-04T13:44:46+00:00" xml:lang="en-US" payloadID="zxysdfdsdafasdfsfdsf">
<Header>
<From>
<Credential domain='NetworkID'>
<Identity></Identity>
</Credential>
</From>
<To>
<Credential domain='NetworkID'>
<Identity></Identity>
</Credential>
</To>
<Sender>
<Credential domain='NetworkID'>
<Identity></Identity>
<SharedSecret></SharedSecret>
</Credential>
<UserAgent></UserAgent>
</Sender>
</Header>
<Message>
<Punch-outOrderMessage>
<BuyerCookie></BuyerCookie>
<Punch-outOrderMessageHeader operationAllowed="edit">
<Total>
<Money currency="USD">300.52</Money>
</Total>
</Punch-outOrderMessageHeader>
<ItemIn quantity="1">
<ItemID>
<SupplierPartID></SupplierPartID>
<SupplierPartAuxiliaryID></SupplierPartAuxiliaryID>
</ItemID>
<ItemDetail>
<UnitPrice>
<Money currency="USD">7.99</Money>
</UnitPrice>
<Description xml:lang="en"></Description>
<UnitOfMeasure>EA</UnitOfMeasure>
</ItemDetail>
</ItemIn>
</Punch-outOrderMessage>
</Message>
</cXML>我试过使用simplexml_load_file。没有帮助。我不知道当买方点击转移车时会发生什么,而且它会加载我提供的页面。
关于cxml的信息不多。很难得到任何信息。
<?php
$xml = simplexml_load_file("cxml_form") or die("Error: Cannot create object");
print_r($xml);
?>PHP
发布于 2019-04-22 14:51:56
当客户单击结帐/转移车时,供应商站点将消息发送到您的页面。然而,为了收到它,您必须自动投递表单。
在页面上添加以下PHP代码:
<?php $xml = file_get_contents('php://input');
$URL = "https://yourlandingpage";
echo "<FORM ID='xmlpostform' METHOD=POST ACTION='" . $URL . "'>";
echo "<INPUT TYPE=HIDDEN NAME='cXML-urlencoded' VALUE='" . $xml . "'>";
echo "<INPUT TYPE=SUBMIT VALUE='Sending Order Information...'>";
echo "</FORM>";
?><SCRIPT LANGUAGE="JavaScript">document.forms["xmlpostform"].submit();</SCRIPT>要使用VB.NET检索值,请执行以下操作:
Dim cxml As String = doc.GetElementById("cXML-urlencoded").GetAttribute("VALUE")https://stackoverflow.com/questions/55785838
复制相似问题