private function _requestRaw($method, $url, $params, $apiKeyRequired)
{
$myApiKey = $this->_apiKey;
if (!$myApiKey) {
if (!($myApiKey = EasyPost::$apiKey)) {
if ($apiKeyRequired) {
throw new Error('No API key provided. Set your API key using "EasyPost::setApiKey(<API-KEY>)". See https://www.easypost.com/docs for details, or contact [email protected] for assistance.');
}
}
}
$absUrl = $this->apiUrl($url);
$params = self::_encodeObjects($params);
$langVersion = phpversion();
$uname = php_uname();
$ua = array('bindings_version' => EasyPost::VERSION, 'lang' => 'php', 'lang_version' => $langVersion, 'publisher' => 'easypost', 'uname' => $uname);
$headers = array('X-EasyPost-Client-User-Agent: ' . json_encode($ua), 'User-Agent: EasyPost/v2 PhpClient/' . EasyPost::VERSION, "Authorization: Bearer {$myApiKey}");
if (EasyPost::$apiVersion) {
$headers[] = 'EasyPost-Version: ' . EasyPost::$apiVersion;
}
list($httpBody, $httpStatus) = $this->_curlRequest($method, $absUrl, $headers, $params, $myApiKey);
return array($httpBody, $httpStatus, $myApiKey);
}