我想从 php 文件中获取我的 google docs 文件,我编写了以下代码:
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);
但返回以下信息:
致命错误:未捕获的异常“Google_ServiceException”和消息“调用 GET 时出错https://www.googleapis.com/drive/v2/files/root/children?q=title%20contains%20%27something%27 : (404) 不是成立'