• php 免费的快递查询接口快递100


    这个快递100的接口是免费的,但是查询过频繁的话可能就没什么效果了。项目比较正规的话还是建议通过申请企业版的物流接口

    直接上代码:

    public function get_expressOp(){
            $url = 'http://www.kuaidi100.com/query?type='.$_GET['e_code'].'&postid='.$_GET['shipping_code'].'&id=1&valicode=&temp='.random(4).'&sessionid=&tmp='.random(4);
            import('function.ftp');
            $content = dfsockopen($url);
            $content = json_decode($content,true);
            $state=$content['state'];
            if ($content['status'] != 200) exit(json_encode(false));
            $content['data'] = array_reverse($content['data']);//返回来的物流信息,根据需要整理成自己的想要的结构
            $output = '';
            $arr=array();
            if (is_array($content['data'])){
                for($i=count($content['data']);$i>0;$i--){
                    $arr[]=$content['data'][$i];
    
                }
                foreach($arr as $k =>$v){
                    if ($v['time'] == '') continue;
                    $content=$v['context'];
                    $info_time=$v['time'];
                    $output.="<li succeed=$state class='typ'>".'<div class="cll-l" ><div class="ball"></div><div class="xian"></div></div>'."<div class='cll-r'><div><i class='iconfont'>&#xe612;</i></div><p>$content</p><samp>$info_time</samp> </div>". "<div class='clear'></div>".'</li>';
    
                }
    
            }
            if ($output == '') exit(json_encode(false));
            if (strtoupper(CHARSET) == 'GBK'){
                $output = Language::getUTF8($output);//网站GBK使用编码时,转换为UTF-8,防止json输出汉字问题
    
            }
            echo json_encode($output);
    
        }

    注释:
    $_GET['e_code']  你的快递公司的字母拼音。
    $_GET['shipping_code']  查询的单号
    
    
    各位多多指教!
  • 相关阅读:
    Karen and Game CodeForces
    Array and Segments (Easy version) CodeForces
    Diverse Garland CodeForces
    Nice Garland CodeForces
    Divisors of Two Integers CodeForces
    Two distinct points CodeForces
    Unique Snowflakes UVA
    Codeforces Round #534 (Div. 2)D. Game with modulo-1104-D(交互+二分+构造)
    关于排列组合问题的基础补充
    杭电 rescue(经典广搜)(深搜广搜对比)
  • 原文地址:https://www.cnblogs.com/lixiaoquan/p/6928827.html
Copyright © 2020-2023  润新知