'', //快递公司编码 'num' => '', //快递单号 'phone' => '', //手机号 'from' => '', //出发地城市 'to' => '', //目的地城市 'resultv2' => '1' //开启行政区域解析 ], $param); $post_data = array(); $post_data["customer"] = self::$kuaidi100_customer; $post_data["param"] = json_encode($param); $sign = md5($post_data["param"] . self::$kuaidi100_key . $post_data["customer"]); $post_data["sign"] = strtoupper($sign); $cacheName = "kd_info_" . $sign; if (Cache::has($cacheName)) { $data = Cache::get($cacheName); $res = json_decode($data, true); if ($res) { return $res; } } $client = new Client(['verify' => false]); $response = $client->request('POST', self::$kuaidi100_url, ['form_params' => $post_data])->getBody()->getContents(); $data = \GuzzleHttp\json_decode($response, true); Cache::set($cacheName, json_encode($data), self::$kuaidi100_cache); return $data; } }