protected function requestDownload($url, $dir = '', $filename = '') { $params['access_token'] = $this->access_token->get(); $params = array_merge($params, $this->_data); $contents = $this->http->get($url, $params)->getRequest(); Error::check(json_decode($contents['data'], true)); $ext = File::getStreamExt($contents['headers']); $filename = $filename ? $filename : md5($contents['data']) . $ext; file_put_contents($filename, $contents['data']); return $dir . $filename; }
private function getUserFromCode($userid) { $access_token = $this->access_token->get(); $data = $this->http->get(self::CORP_USERINFO_URL . "?access_token={$access_token}&userid={$userid}")->getJsonToArray(); return Error::check($data); }