headers = array_merge($http->headers, $extraHeaders); $ok = $http->sendRequest($endpoint->getAbsoluteUri(), $requestBody, $method); if(!$ok){ $msg = "An error occured during the request to the oauth provider:\n"; throw new TokenResponseException($msg . $http->error); } return $http->resp_body; } }