D
D
Deno952016-03-08 02:34:48
Google
Deno95, 2016-03-08 02:34:48

How to download file from google drive using google api?

How to download a private file using google API using php. Do not throw a link to the google api documentation, because if everything was clear there, the question would not have arisen.
All I understood from there is to use the library for this https://github.com/google/google-api-php-client. It has two options, which one do I need? And how to build a request to download a file from my repository. I understand that in order to download, you must first access the acanthus (but I don't quite understand how to check if I got access or not).
I tried this option, the array was empty and did not give out anything.
YOUR_APP_KEY - here I substitute the API key that I generated for my IP.
Client_Library_Examples - I left it as it is because I did not understand what is needed here.
Access was opened for the books API in the office, there are no errors, but there are no data either.

<?php

  require_once 'google-api-php-client/src/Google/autoload.php'; // or wherever autoload.php is located

  $client = new Google_Client();
  $client->setApplicationName("Client_Library_Examples");
  $client->setDeveloperKey("YOUR_APP_KEY");

  $service = new Google_Service_Books($client);
  $optParams = array('filter' => 'free-ebooks');
  $results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);

  foreach ($results as $item) {
    echo $item['volumeInfo']['title'], "<br /> \n";
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Deno95, 2016-04-01
@Deno95

In order to download the file, you need to use authorization as in the example https://developers.google.com/drive/v3/web/quickst... and expand the dip provided by the user

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question