0
<?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 GET files list doesn't work.

how can i get files list like that? mimetype : audio/mpeg and fields get title and webcontentlink.

Mark
  • 73
  • 1
  • 8

1 Answers1

0

Why are you building a GET request? You should be using the API to list files

I'm not 100% sure how to go about incorporating the information from the "Search for Files" doc, but rather than building that query directly like you are, you should be attempting to leverage the library.

ernie
  • 6,356
  • 23
  • 28