SimpleOAuth2Handler::MakeRequest PHP Метод

MakeRequest() защищенный Метод

Makes an HTTP request to the given URL and extracts the returned OAuth2 response.
protected MakeRequest ( string $url, array $params ) : OAuthToken
$url string the URL to make the request to
$params array the parameters to include in the POST body
Результат OAuthToken the returned token
    protected function MakeRequest($url, $params)
    {
        $ch = $this->curlUtils->CreateSession($url);
        $this->curlUtils->SetOpt($ch, CURLOPT_POST, 1);
        $this->curlUtils->SetOpt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
        $response = $this->curlUtils->Exec($ch);
        $error = $this->curlUtils->Error($ch);
        $httpCode = $this->curlUtils->GetInfo($ch, CURLINFO_HTTP_CODE);
        $this->curlUtils->Close($ch);
        if (!empty($error)) {
            throw new OAuth2Exception($error, $httpCode);
        }
        if ($httpCode != 200) {
            throw new OAuth2Exception($response, $httpCode);
        }
        return json_decode($response, true);
    }