PHP Express number query interface using sample _php instance

Source: Internet
Author: User

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
}

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.