示例#1
0
 protected function queryOld($scope, $method = "GET", $data = null, $skipRefreshAuth = false)
 {
     if ($this->engineSettings['AUTH']) {
         $http = new \CHTTP();
         $http->setAdditionalHeaders(array('Authorization' => 'OAuth ' . $this->engineSettings['AUTH']['access_token']));
         $http->setFollowRedirect(false);
         switch ($method) {
             case 'GET':
                 $result = $http->get($scope);
                 break;
             case 'POST':
                 $result = $http->post($scope, $data);
                 break;
             case 'PUT':
                 $result = $http->httpQuery($method, $scope, $http->prepareData($data));
                 break;
             case 'DELETE':
                 break;
         }
         if ($http->status == 401 && !$skipRefreshAuth) {
             if ($this->checkAuthExpired(false)) {
                 $this->queryOld($scope, $method, $data, true);
             }
         }
         $http->result = Text\Encoding::convertEncoding($http->result, 'utf-8', LANG_CHARSET);
         return $http;
     }
 }