- Модуль: seo
- Путь к файлу: ~/bitrix/modules/seo/lib/engine/google.php
- Класс: BitrixSeoEngineGoogle
- Вызов: Google::query
protected function query($scope, $method = "GET", $data = null, $bSkipRefreshAuth = false, $contentType = 'application/json')
{
if($this->engineSettings['AUTH'])
{
$http = new HttpClient();
$http->setHeader("Authorization", 'Bearer '.$this->engineSettings['AUTH']['access_token']);
/*
$http->setAdditionalHeaders(
array(
'Authorization' => ,
'GData-Version' => '2'
)
);
*/
switch($method)
{
case 'GET':
$result = $http->get($scope);
break;
case 'POST':
case 'PUT':
$http->setHeader("Content-Type", $contentType);
if(!$data)
{
$http->setHeader("Content-Length", 0);
}
$result = $http->query($method, $scope, $data);
break;
case 'DELETE':
break;
}
if($http->getStatus() == 401 && !$bSkipRefreshAuth)
{
if($this->checkAuthExpired(true))
{
return $this->query($scope, $method, $data, true, $contentType);
}
}
return $http;
}
}