谷歌驱动器 API v2 PHP


google drive api v2 php

它不起作用下载文件。文档的功能https://developers.google.com/drive/v2/web/manage-downloads

写: Class 'Google_Http_Request' not found

这里https://github.com/google/google-api-php-client/blob/master/UPGRADING.md 写的是Removed Google_Http_Request.

如果您使用 likeness ,将其更改为 GET 请求并替换链接,如上面的最后一个链接中所述

$httpClient = $client->authorize(); 
$request = new GuzzleHttp'Psr7'Request('POST', $url); 
$response = $httpClient->send($request);

写:

Argument 1 passed to GuzzleHttp'Client::send() must implement interface GuzzleHttp'Message'RequestInterface, instance of GuzzleHttp'Psr7'Request given, called in 'file.php on line 37 and defined in 'vendor'guzzlehttp'guzzle'src'Client.php on line 158

那些经历过这个的人 ?有什么解决方案吗?

我在使用Google Cloud Storage php API时遇到了同样的问题。 像这样尝试:

$httpClient = $client->authorize();
$response = $httpClient->get($url);

然后,如果您需要将其转储到浏览器(例如,如果您要检索图像):

echo $response->getBody();