|
@@ -34,4 +34,27 @@ function __construct(){
|
|
|
}
|
|
|
return $list;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 根据快递单号获取物流信息
|
|
|
+ * @param $params 快递单号数组
|
|
|
+ */
|
|
|
+ public function get_detail($params){
|
|
|
+ $url = 'https://api.17track.net/track/v2.4/gettrackinfo';
|
|
|
+ $header[] = "17token:0811AC1711EAABB7D764D04B824F8C2D";
|
|
|
+ $header[] = "Content-Type:application/json";
|
|
|
+
|
|
|
+ $ch = curl_init();
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
|
|
+ curl_setopt($ch, CURLOPT_POST, 1);
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
|
|
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
+ curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);
|
|
|
+ $res = curl_exec($ch);
|
|
|
+ curl_close($ch);
|
|
|
+ $res = json_decode($res,true);
|
|
|
+ return $res;
|
|
|
+ }
|
|
|
} //end class
|