private function _requestRaw($method, $url, $params, $headers) { $myApiKey = $this->_apiKey; if (!$myApiKey) { $myApiKey = Pingpp::$apiKey; } if (!$myApiKey) { $msg = 'No API key provided. (HINT: set your API key using ' . '"Pingpp::setApiKey(<API-KEY>)". You can generate API keys from ' . 'the Pingpp web interface. See https://pingxx.com/document/api for ' . 'details.'; throw new Error\Authentication($msg); } $absUrl = $this->_apiBase . $url; $params = self::_encodeObjects($params, $method == 'post'); $langVersion = phpversion(); $uname = php_uname(); $ua = array('bindings_version' => Pingpp::VERSION, 'lang' => 'php', 'lang_version' => $langVersion, 'publisher' => 'pingplusplus', 'uname' => $uname); $defaultHeaders = array('X-Pingpp-Client-User-Agent' => json_encode($ua), 'User-Agent' => 'Pingpp/v1 PhpBindings/' . Pingpp::VERSION, 'Authorization' => 'Bearer ' . $myApiKey); if (Pingpp::$apiVersion) { $defaultHeaders['Pingplusplus-Version'] = Pingpp::$apiVersion; } if ($method == 'post' || $method == 'put') { $defaultHeaders['Content-type'] = 'application/json;charset=UTF-8'; } if ($method == 'put') { $defaultHeaders['X-HTTP-Method-Override'] = 'PUT'; } $requestHeaders = Util\Util::getRequestHeaders(); if (isset($requestHeaders['Pingpp-Sdk-Version'])) { $defaultHeaders['Pingpp-Sdk-Version'] = $requestHeaders['Pingpp-Sdk-Version']; } if (isset($requestHeaders['Pingpp-One-Version'])) { $defaultHeaders['Pingpp-One-Version'] = $requestHeaders['Pingpp-One-Version']; } $combinedHeaders = array_merge($defaultHeaders, $headers); $rawHeaders = array(); foreach ($combinedHeaders as $header => $value) { $rawHeaders[] = $header . ': ' . $value; } list($rbody, $rcode) = $this->_curlRequest($method, $absUrl, $rawHeaders, $params); return array($rbody, $rcode, $myApiKey); }