Through this interface can query Yuantong Express, Shentong Express, EMS Express, Yun da Express, such as express number inquiry information, no other additional development, very convenient
First go to the www.aikuaidi.cn to register an account, use the key!
Copy Code code as follows:
<?php
/**
* Inquiry Logistics Information
*/
Define (' In_ecs ', true);
Require (DirName (__file__). '/includes/init.php ');
if ($id = Intval ($_request[' id ')) {
$sql _select = ' Select Consignee,mobile,tel,tracking_sn,shipping_code,shipping_name from '.
$GLOBALS [' ECS ']->table (' Order_info '). " WHERE order_id= $id ";
$order _info = $GLOBALS [' db ']->getrow ($sql _select);
Express Company Code Map
$shipping _code = Array (
' EMS ' => ' EMS ',
' Ems2 ' => ' EMS ',
' Sto_express ' => ' Zjs ',
' Sto_nopay ' => ' Zjs ',
' Zto ' => ' Zhongtong ',
' Sto ' => ' Shentong ',
' Yto ' => ' Yuantong ',
' SF ' => ' Shunfeng ',
' Emssn ' => ' EMS ',
' SF2 ' => ' Shunfeng ',
' Yunda ' => ' Yunda ',
);
$logistics _code = $shipping _code[$order _info[' Shipping_code ']? $shipping _code[$order _info[' Shipping_code ']: $order _info[' Shipping_code '];
$aikuaidi _key = ' xxxxxxx ';
$logistics _url = "http://www.aikuaidi.cn/rest/?key= $aikuaidi _key&order={$order _info[' tracking_sn ']}&id=$ Logistics_code&ord=asc&show=html ";
$logistics _info = file_get_contents ($logistics _url);
Var_dump ($logistics _info);
$logistics _info = iconv (' gb2312 ', ' UTF-8 ', $logistics _info);
Echo <<<eof
<span> consignee: <strong>{$order _info[' consignee ']}</strong></span>
<span> Tel: <strong>{$order _info[' mobile '}//{$order _info[' tel ']}</strong></span>
<span> Distribution: <strong>{$order _info[' shipping_name ']}</strong></span>
<span> waybill No.: <strong>{$order _info[' tracking_sn ']}</strong></span><br><br>
EOF;
echo $logistics _info;
echo "<br><br><a href= ' $logistics _url ' target= ' _self ' > Dot i dot i </a>";
Exit
}