Jerome Ansia
Jerome Ansia

Reputation: 6884

Google Drive SDK - Php Client Library - Download a file where i can find the classes?

I try to download a file using this method

/**
 * 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;
  }
}

found there : https://developers.google.com/drive/v2/reference/files/get

But i don't know where in the library i can find those two classes that i need to include :

  • Google_HttpRequest
  • Google_Client

Library: http://code.google.com/p/google-api-php-client/

Upvotes: 2

Views: 2949

Answers (1)

Related Questions