Php express bill number query interface example _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.