public function get() { $this->build(); $resp = Http::get(self::API, $this->param); $arr = Json::createFromString($resp)->parse(); return $arr['ip_list']; }
public function get() { $this->build(); $resp = Http::get(self::API, $this->param); $arr = Json::createFromString($resp)->parse(); $this->checkError($arr); return $arr; }
public function get() { $get = $_GET; if (isset($get['code'], $get['stat'])) { // 响应 $code = $get['code']; $stat = $get['stat']; $statLocal = $this->getCache()->get($this->getStatCacheKey()); if ($stat != $statLocal) { header("HTTP/1.0 404 Not Found"); exit; } // 获取 access token $atCode = new AccessTokenCode($this->account, $code); $atCode->get(); } else { $this->build(); $url = Http::build(self::API, $this->param); // 跳转 Helper::redirect($url); } }
/** * @param bool $force * @return array|mixed * @throws Exception */ private function getData($force = false) { $resp = null; if ($this->useCache && !$force) { $resp = $this->getCache()->get($this->cacheKey); } if ($resp) { return $resp; } $this->build(); $resp = Http::get(self::API_GET_AT, $this->param); if (!$resp) { throw new Exception('网络异常,没有获取到任何结果'); } $arr = Json::createFromString($resp)->parse(); $this->checkError($arr); if ($this->useCache) { $cache = $this->getCache(); $cache->setExpires($arr['expires_in']); $cache->set($this->cacheKey, $arr); } return $arr; }