我想得到TNT澳大利亚原产地和交货地址之间的所有运输方式的活率。
如 * 公路快递、隔夜快递、隔夜PAYU挎包、9点快递、10点快递等 *
我使用下面的代码。
function sendToTNTServer( $Xml ) {
$postdata = http_build_query(
array(
//For Future reference
//the xml_in= ( the = ) is appended
//Automatically by PHP
'xml_in' => $Xml
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create( $opts );
$output = file_get_contents(
'http://www.tntexpress.com.au/expressconnect/pricing/getprice',
false,
$context
);
return $output;
}
$XmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<PRICEREQUEST>
<LOGIN>
<COMPANY>username</COMPANY>
<PASSWORD>password</PASSWORD>
<APPID>PC</APPID>
</LOGIN>
<PRICECHECK>
<RATEID>rate1</RATEID>
<ORIGINCOUNTRY>AU</ORIGINCOUNTRY>
<ORIGINTOWNNAME>Atherstone</ORIGINTOWNNAME>
<ORIGINPOSTCODE>2217</ORIGINPOSTCODE>
<ORIGINTOWNGROUP/>
<DESTCOUNTRY>AU</DESTCOUNTRY>
<DESTTOWNNAME>Alicante</DESTTOWNNAME>
<DESTPOSTCODE>6009</DESTPOSTCODE>
<DESTTOWNGROUP/>
<CONTYPE>N</CONTYPE>
<CURRENCY>AUD</CURRENCY>
<WEIGHT>18</WEIGHT>
<VOLUME>1</VOLUME>
<ACCOUNT/>
<ITEMS>1</ITEMS>
</PRICECHECK>
</PRICEREQUEST>";
$returnXml = sendToTNTServer( $XmlString );
echo $returnXml;
但向我显示登录详细信息无效的消息。
我们在http://www.tntexpress.com.au/链接上创建的TNT帐户。
我使用php作为服务器端语言。
2条答案
按热度按时间xwbd5t1u1#
经过与TNT公司的多次交涉和讨论,我得到了答案。
0ve6wy6x2#