Domanda

i want to get my google docs files from a php file, and i write following codes:

require_once ("google/Google_Client.php");
require_once ("google/contrib/Google_DriveService.php");

$client=new Google_Client();
$client->setClientId('XXXX');
$client->setClientSecret('xxxx');
$client->setRedirectUri('urn:ietf:wg:oauth:2.0:oob');
$client->setScopes(array('https://www.googleapis.com/auth/drive'));
$service = new Google_DriveService($client);
$parameters=array();
$parameters['q'] = "title contains 'something'";
$children = $service->children->listChildren('root',$parameters);
var_dump($children);

but return the following information:

Fatal error: Uncaught exception 'Google_ServiceException' with message 'Error calling GET https://www.googleapis.com/drive/v2/files/root/children?q=title%20contains%20%27something%27: (404) Not Found'

È stato utile?

Soluzione

Your application is not performing the OAuth flow correctly, check the PHP quickstart sample in the Google Drive SDK docs to see how that should be implemented:

https://developers.google.com/drive/quickstart

Once your code performs the OAuth flow correctly, you can replace the code in the sample to upload a file with yours to perform a search.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top