快递查询

public function showLogistics(){
    $type=$_POST['type']='shentong';
    $postid=$_POST['postid']='3311725299939';
    //$url = "http://m.kuaidi100.com/index_all.html?type=".$goods_orderarr["express_con"]."&postid=".$goods_orderarr["out_order_num"];
    $url = "http://m.kuaidi100.com/query?type={$type}&postid={$postid}&id=1";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch,CURLOPT_HEADER, 0); //设置Header
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//测试时输出到页面 0
    $json = curl_exec($ch);
    curl_close($ch);
    $re = json_decode($json,true);
    $rs = array(
        "list"=>$re
    );
    if($re["status"]=="200"){
        $re = array("status"=>1,"code"=>200,"msg"=>"确认成功!","data"=>$rs);
        $this->ajaxReturn($re);
    }else{
        $re = array("status"=>0,"code"=>102,"msg"=>"数据异常,请稍后再试!");
        $this->ajaxReturn($re);
    }
}
原文地址:https://www.cnblogs.com/binghuo000/p/6641103.html