settings = $settings; } } public function auth() { if (isset($_GET['code'])) { $query = urldecode(http_build_query($this->settings + ["code" => $_GET['code']])); $token = json_decode(file_get_contents("https://oauth.vk.com/access_token?" . $query), true); if (isset($token["access_token"])) { $this->data = $token; return true; } } return false; } public function get_link() { $query = urldecode(http_build_query([ "client_id" => $this->settings["client_id"], "redirect_uri" => $this->settings["redirect_uri"], "response_type" => "code" ])); return "https://oauth.vk.com/authorize?" . $query; } }