protected function query($scope, $method = "GET", $data = null, $bSkipRefreshAuth = false, $contentType = 'application/atom+xml') { if ($this->engineSettings['AUTH']) { $http = new \CHTTP(); $http->setAdditionalHeaders(array('Authorization' => 'Bearer ' . $this->engineSettings['AUTH']['access_token'], 'GData-Version' => '2')); switch ($method) { case 'GET': $result = $http->get($scope); break; case 'POST': case 'PUT': $arUrl = $http->parseURL($scope); $result = $http->query($method, $arUrl['host'], $arUrl['port'], $arUrl['path_query'], $data, $arUrl['proto'], $contentType); break; case 'DELETE': break; } if ($http->status == 401 && !$bSkipRefreshAuth) { if ($this->checkAuthExpired(true)) { return $this->query($scope, $method, $data, true, $contentType); } } return $http; } }