public function getUserInfo($accessToken) { // Get the correct Profile Endpoint URL based off the country/region provided in the config['region'] $this->profileEndpointUrl(); if (empty($accessToken)) { throw new \InvalidArgumentException('Access Token is a required parameter and is not set'); } // To make sure double encoding doesn't occur decode first and encode again. $accessToken = urldecode($accessToken); $url = $this->profileEndpoint . '/auth/o2/tokeninfo?access_token=' . urlEncode($accessToken); $httpCurlRequest = new HttpCurl($this->config); $response = $httpCurlRequest->httpGet($url); $data = json_decode($response); if ($data->aud != $this->config['client_id']) { // The access token does not belong to us throw new \Exception('The Access token entered is incorrect'); } // Exchange the access token for user profile $url = $this->profileEndpoint . '/user/profile'; $httpCurlRequest = new HttpCurl($this->config); $httpCurlRequest->setAccessToken($accessToken); $httpCurlRequest->setHttpHeader(true); $response = $httpCurlRequest->httpGet($url); $userInfo = json_decode($response, true); return $userInfo; }
private function getCertificate($certificatePath) { $httpCurlRequest = new HttpCurl($this->ipnConfig); $response = $httpCurlRequest->httpGet($certificatePath); return $response; }