{ "success": true, "reason": "", "data": [{ "time": "2015-10-20 18:35:13", "context": "\u5df2\u7b7e\u6536,\u7b7e\u6536\u4eba\u662f:\u95e8\u536b\u7b7e\u6536" }, { "time": "2015-10-20 10:20:17", "context": "\u56db\u5ddd\u8fbe\u5dde\u5927\u7af9\u516c\u53f8\r\r\u7684\u6d3e\u4ef6\u5458\u7 18a\u59d0\u6b63\u5728\u6d3e\u4ef6" }, { "time": "2015-10-20 09:40:40", "context": "\u5feb\u4ef6\u5df2\u5230\u8fbe\u56db\u5ddd\u8fbe\u5dde\u5927\u7af9\u516c\u53f8" }, { "time": "2015-10-20 03:00:23", "context": "\u56db\u5ddd\u5357\u5145\u4e2d\u8f6c\u90e8\r\r\u6b63\u5728\u8fdb\u884c\u88c5\u8 f66\u626b\u63cf" }, { "time": "2015-10-20 03:00:23", "context": "\u7531\u56db\u5ddd\u5357\u5145\u4e2d\u8f6c\u90e8\r\r\u53d1\u5f80\u56db\u5ddd\u8 fbe\u5dde\u5927\u7af9\u516c\u53f8" }, { "time": "2015-10-17 23:49:41", "context": "\u7531\u4e0a\u6d77\u822a\u7a7a\u90e8\r\r\u53d1\u5f80\u56db\u5ddd\u6210\u90fd\u8 22a\u7a7a\u90e8" }, { "time": "2015-10-17 21:10:16", "context": "\u7531\u6c5f\u82cf\u5434\u6c5f\u516c\u53f8\r\r\u53d1\u5f80\u4e0a\u6d77\u822a\u7 a7a\u90e8" }, { "time": "2015-10-17 20:57:19", "context": "\u7531\u6c5f\u82cf\u5434\u6c5f\u516c\u53f8\r\r\u53d1\u5f80\u4e0a\u6d77\u822a\u7 a7a\u90e8" }, { "time": "2015-10-17 20:57:19", "context": "\u6c5f\u82cf\u5434\u6c5f\u516c\u53f8\r\r\u6b63\u5728\u8fdb\u884c\u88c5\u888b\u6 26b\u63cf" }, { "time": "2015-10-17 20:23:17", "context": "\u6c5f\u82cf\u5434\u6c5f\u516c\u53f8\r\r\u7684\u6536\u4ef6\u5458\u9ece\u91cc\u7 247\u533a\u6dd8\u5b9d\u5df2\u6536\u4ef6" } ], "status": 6 }
<?php /** * Created by PhpStorm. * User: FZS * Time: 2019/9/3 23:10 */ //---------------------------------- // 快递查询 调用类 //---------------------------------- class freeApi{ private $apiUrl; public function __construct($ak){ $this->apiUrl = 'http://api.kuaidi.com/openapi.html?id=[]&com=[]&nu=[]&show=[0|1]&muti=[0|1]&order=[desc|asc]'; } /** * 获取结果 * @return array */ public function getResult(){ return $this->freeApiCurl($this->apiUrl); } /** * 请求接口返回内容 * @param string $url [请求的URL地址] * @param string $params [请求的参数] * @param int $ipost [是否采用POST形式] * @return string */ public function freeApiCurl($url,$params=false,$ispost=0){ $ch = curl_init(); curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 ); curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 ); curl_setopt( $ch, CURLOPT_USERAGENT , 'free-api' ); curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 60 ); curl_setopt( $ch, CURLOPT_TIMEOUT , 60); curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true ); if( $ispost ) { curl_setopt( $ch , CURLOPT_POST , true ); curl_setopt( $ch , CURLOPT_POSTFIELDS , $params ); curl_setopt( $ch , CURLOPT_URL , $url ); } else { if($params){ curl_setopt( $ch , CURLOPT_URL , $url.'?'.$params ); }else{ curl_setopt( $ch , CURLOPT_URL , $url); } } $response = curl_exec( $ch ); if ($response === FALSE) { return false; } curl_close( $ch ); return $response; } }