Google google file file list not working

<?php require_once './src/Google_Client.php'; require_once './src/contrib/Google_DriveService.php'; $client = new Google_Client(); $client->setApplicationName("test"); $client->setClientId('test.apps.googleusercontent.com'); $client->setClientSecret('test'); $client->setRedirectUri('http://test.com/'); $client->setScopes(array('https://www.googleapis.com/auth/drive','https://www.googleapis.com/auth/drive.readonly','https://www.googleapis.com/auth/drive.file','https://www.googleapis.com/auth/drive.metadata.readonly','https://www.googleapis.com/auth/drive.appdata','https://www.googleapis.com/auth/drive.apps.readonly')); if(empty($_GET['code'])) { $client->authenticate(); } $service = new Google_DriveService($client); $client->setAccessToken($accessToken); $accessToken = $client->authenticate($_GET['code']); $response = http_get("https://www.googleapis.com/drive/v2/files?q=mimeType+%3D+'audio%2Fmpeg'&fields=items(title%2CwebContentLink)&key=".$accessToken); print_r($response); ?> 

This list of GET files does not work.

How can I get a list of files? mimetype: audio / mpeg and fields get a header and webcontentlink.

0
source share
1 answer

Why are you building a GET request? You must use the API to display files

I’m not 100% sure how to include the information from the File Search document, but instead of creating a query like you, you should try to use the library.

0
source

Source: https://habr.com/ru/post/1209324/


All Articles