簡體   English   中英

PHP Google驅動器文件列表不起作用

[英]PHP google drive files list doesn't work

<?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);


?>

此GET文件列表不起作用。

我如何獲得這樣的文件列表? mimetype:音頻/ MPEG和字段獲取標題和webcontentlink。

您為什么要建立GET請求? 您應該使用API​​列出文件

我不是100%不確定如何合並“ Search for Files ”文檔中的信息,但是您應該嘗試利用該庫,而不是像您一樣直接構建該查詢。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM