谷歌驱动器api v2 php

时间:2016-02-23 19:28:49

标签: php google-drive-api google-api-php-client

下载文件不起作用。文档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

如果您使用相似性,将其更改为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

那些经历过这种情况的人?该问题的任何解决方案?

1 个答案:

答案 0 :(得分:0)

我遇到了与Google Cloud Storage php API相同的问题。试试这样:

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

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

echo $response->getBody();