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);
}