This article describes how to use the php Express bill number query interface. For more information, see
This article describes how to use the php Express bill number query interface. For more information, see
This interface can be used to query the information of express waybills such as yuantong Express, Shentong express, EMS express, and yunda Express, which is convenient without additional development.
First register an account and use the key!
The Code is as follows:
/**
* Query 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 );
// Courier company code ing
$ Shipping_code = array (
'EMS' => 'EMS ',
'Ems2' => 'EMS ',
'Sto _ express '=> 'zjs ',
'Sto _ nopa' => 'zjs ',
'Zto' => 'zhongtong ',
'Sto '=> 'shentong ',
'Yto '=> 'yuyun G ',
'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 < Receiver: {$ Order_info ['consignee']}
Contact Number: {$ Order_info ['mobile']} // {$ order_info ['tel']}
Delivery: {$ Order_info ['shipping _ name']}
Waybill No: {$ Order_info ['tracking _ sn ']}
EOF;
Echo $ logistics_info;
Echo"
Click me ";
// Exit;
}