Google云端硬盘api范围

时间:2016-12-10 04:58:06

标签: php api google-api

这是我的代码

<?php

    require_once     '/home/bachus03/domains/bachus03.vot.pl/public_html/fb/vendor/autoload.php';

    putenv('GOOGLE_APPLICATION_CREDENTIALS=/home/bachus03/domains/bachus03.vot.pl/public_html/fb/public/service-account.json');
    $client = new Google_Client();
    $client->setScopes(['https://www.googleapis.com/auth/drive.metadata']);
    $client->useApplicationDefaultCredentials();

    $files = new Google_Service_Drive_DriveFile($client);
    $response = $files->getOwners();
    echo json_encode($response) . "\n";

?>

在我运行test.php脚本后,我得到了:

[bachus03@s14:: ~ ]:$    /usr/local/php/p56/bin/php   /home/bachus03/domains/bachus03.vot.pl/public_html/fb/public/test.php
NUll

我做错了什么?

0 个答案:

没有答案