- Модуль: seo
- Путь к файлу: ~/bitrix/modules/seo/lib/engine/yandex.php
- Класс: BitrixSeoEngineYandex
- Вызов: Yandex::query
protected function query($scope, $method = "GET", $data = NULL, $skipRefreshAuth = false)
{
if ($this->engineSettings['AUTH'])
{
$http = new HttpClient();
$http->setHeader('Authorization', 'OAuth ' . $this->engineSettings['AUTH']['access_token']);
$http->setRedirect(false);
switch ($method)
{
case 'GET':
$http->get($scope);
break;
case 'POST':
$http->setHeader('Content-type', 'application/json');
$http->post($scope, $data);
break;
case 'DELETE':
break;
}
if ($http->getStatus() == 401 && !$skipRefreshAuth)
{
if ($this->checkAuthExpired())
{
$this->query($scope, $method, $data, true);
}
}
return $http;
}
}