吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 7108|回复: 3
收起左侧

[其他转载] 一个php查询快递的源码

[复制链接]
wangdianchaxun 发表于 2014-9-9 14:44
没太多可以介绍的,功能就是能查询各大快递物流的单号,如圆通快递,申通快递,韵达快递,宅急送快递,中通快递等等,具体有多少我也数不过来,可以到www.aikuaidi.cn去看看能查询那些快递,我这里的源码是基于他们的接口来做的,好了,我直接传php源码。需要的可以去申请就可以用了,直接传提示403是什么情况,还得我把代码帖出来!
<?php
/**
* 查询物流信息
*/
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);

    // 快递公司code映射
    $shipping_code = array (
        'ems'         => 'ems',
        'sto'         => 'shentong',
        'yto'         => 'yuantong',
        'sf'          => 'shunfeng',
        'yunda'       => 'yunda',
    );

    $logistics_code = $shipping_code[$order_info['shipping_code']] ? $shipping_code[$order_info['shipping_code']] : $order_info['shipping_code'];
    $aikuaidi_key = 'xxx'; //爱快递www.aikuaidi.cn上申请

    $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);

EOF;
    echo $logistics_info;
    //exit;
}

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

2314902431 发表于 2014-9-9 15:06
内置预设不好.让用户自行选择吧.这样也不会被局限.
我可能干了 发表于 2014-9-9 15:39
车俊 发表于 2014-9-9 17:14
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-9-22 11:38

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表