Google Drive SDK - Php客户端库 - 下载可以找到课程的文件?

时间:2012-08-07 16:26:44

标签: google-drive-api

我尝试使用此方法下载文件

/**
 * Download a file's content.
 *
 * @param Google_DriveService $service Drive API service instance.
 * @param File $file Drive File instance.
 * @return String The file's content if successful, null otherwise.
 */
function downloadFile($service, $file) {
  $downloadUrl = $file->getDownloadUrl();
  if ($downloadUrl) {
    $request = new Google_HttpRequest($downloadUrl, 'GET', null, null);
    $httpRequest = Google_Client::$io->authenticatedRequest($request);
    if ($httpRequest->getResponseHttpCode() == 200) {
      return $httpRequest->getResponseBody();
    } else {
      // An error occurred.
      return null;
    }
  } else {
    // The file doesn't have any content stored on Drive.
    return null;
  }
}

在那里找到:https://developers.google.com/drive/v2/reference/files/get

但是我不知道在图书馆的哪个地方我可以找到我需要包含的那两个类:

  
      
  • Google_HttpRequest
  •   
  • Google_Client
  •   

图书馆:http://code.google.com/p/google-api-php-client/

相关问题