Php express bill number query interface example. This interface can be used to query the information of express waybills such as Yuantong Express, Shentong Express, EMS Express, and Yunda Express. no additional development is required, it is very convenient to first register on www.aikuaidi.cn through this interface can query the Yuantong Express, Shentong Express, EMS Express, rhyme delivery and other express bill number query information, no additional development, very convenient
Register an account on www.aikuaidi.cn 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;
}
First register on www.aikuaidi.cn...