zoukankan      html  css  js  c++  java
  • PHP对接阿里云物流信息接口

    public function  logistics($no,$type){
    $host = "https://wuliu.market.alicloudapi.com"; $path = "/kdi"; $method = "GET"; $appcode = "XXXXXXX"; $headers = array(); array_push($headers, "Authorization:APPCODE " . $appcode); $querys = "no=$no&type=$type"; //参数写在这里 $no要查询的快递单号,$type 那家的快递编码 阿里云的编码 自己对照 可不写 $bodys = ""; $url = $host . $path . "?" . $querys; $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); if (1 == strpos("$".$host, "https://")){ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); } curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys); $res=curl_exec($curl); $data=json_decode($res); if($data->status==0){ $wuliu=$data->result->list; return ['code'=>2000,'msg'=>'成功','data'=>$wuliu]; }else{ return ['code'=>4000,'msg'=>'暂无物流信息']; }
    }
  • 相关阅读:
    Pandas DataFrame操作
    Pandas Series数据结构基本操作
    Locally weighted regression algorithm
    Python Numpy线性代数操作
    Python Numpy 矩阵级基本操作(2)
    分布式锁1 Java常用技术方案(转)
    设计模式
    设计模式
    设计模式
    Lock和synchronized比较详解(转)
  • 原文地址:https://www.cnblogs.com/cyk2/p/15337238.html
Copyright © 2011-2022 走看看