PHP如何使用appVersion 3.2将XML请求发布到服务器(TNT Express Connect定价模块)



在这篇文章中,@MackieeE展示了TNT API 2.0版本的有效解决方案。我正在尝试使用3.2版本,但它不起的作用

我使用这个值:

<?xml version="1.0" encoding="UTF-8"?>
<priceRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<appId>PC</appId>
<appVersion>3.2</appVersion>
<priceCheck>
<rateId>rate2</rateId>
<sender>
<country>ES</country>
<town>BENISSA</town>
<postcode>03720</postcode>
</sender>
<delivery>
<country>ES</country>
<town>TORREFARRERA</town>
<postcode>25123</postcode>
</delivery>
<collectionDateTime>2019-05-07T11:10:00</collectionDateTime>
<product>
<id>15N</id>
<type>N</type>
</product>
<account>
<accountNumber>YOUR ACCOUNT NUMBER</accountNumber>
<accountCountry>ES</accountCountry>
</account>
<insurance>
<insuranceValue>110.00</insuranceValue>
<goodsValue>100.00</goodsValue>
</insurance>
<currency>EUR</currency>
<priceBreakDown>true</priceBreakDown>
<consignmentDetails>
<totalWeight>1.25</totalWeight>
<totalVolume>0.1</totalVolume>
<totalNumberOfPieces>1</totalNumberOfPieces>
</consignmentDetails>
<pieceLine>
<numberOfPieces>1</numberOfPieces>
<pieceMeasurements>
<length>1</length>
<width>2</width>
<height>3</height>
<weight>1.25</weight>
</pieceMeasurements>
<pallet>1</pallet>
</pieceLine>
</priceCheck>
</priceRequest>

答案是:

找不到元素"priceRequest"的声明

在https://express.tnt.com/expresswebservices-website/app/pricingrequest.html工作正常,但我需要在我的Php代码中做到这一点。

有什么帮助吗?感谢

如果您需要获得价格,请使用此apihttps://express.tnt.com/expressconnect/pricing/getprice但我不确定它是否能下订单。此外,我的php代码中的response也有问题。事实证明,TNT以字符串形式发回XML文件。

simplexml_load_string($result(

最新更新