protected function initRequest($url, $requestHeaders = array())
{
if (substr($url, 0, 4) !== "http") {
$url = $this->serviceUrl . $url;
}
$ch = curl_init();
curl_setopt_array($ch, $this->curlParams);
curl_setopt($ch, CURLOPT_URL, $url);
$headers = array();
if (count($this->getHeaders()) > 0) {
foreach ($this->getHeaders() as $k => $v) {
$headers[] = "{$k}: {$v}";
}
}
$headers[] = "Authorization: " . $this->tokenType . " " . $this->accessToken;
$headers = array_merge($headers, $requestHeaders);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERAGENT, $this->getUserAgent());
return $ch;
}