导出无法在Google Drive API REST 3和PHP中使用

I'm trying to export an excel file to scv file from the Google Drive, using this API:

https://developers.google.com/drive/v3/reference/files/export

https://developers.google.com/drive/v3/web/manage-downloads

I'm using google-api-php-client-2.1.0.

My code is:

$content = $service->files->export($fileId, 'text/csv', array('alt' => 'media');

But I don't receive content, only GuzzleHttp\Psr7\Response.

Full response:

GuzzleHttp\Psr7\Response::__set_state(array(
'reasonPhrase' => 'OK',
'statusCode' => 200,
'headers' =>
array (
'expires' =>
array (
0 => 'Fri, 30 Dec 2016 11:18:35 GMT',
),
'date' =>
array (
0 => 'Fri, 30 Dec 2016 11:18:35 GMT',
),
'cache-control' =>
array (
0 => 'private, max-age=0, must-revalidate, no-transform',
),
'content-disposition' =>
array (
0 => 'attachment',
),
'vary' =>
array (
0 => 'Origin',
1 => 'X-Origin',
),
'content-type' =>
array (
0 => 'text/csv',
),
'x-content-type-options' =>
array (
0 => 'nosniff',
),
'x-frame-options' =>
array (
0 => 'SAMEORIGIN',
),
'x-xss-protection' =>
array (
0 => '1; mode=block',
),
'content-length' =>
array (
0 => '0',
),
'server' =>
array (
0 => 'GSE',
),
'alt-svc' =>
array (
0 => 'quic=":443"; ma=2592000; v="35,34"',
),
),
'headerLines' =>
array (
'Expires' =>
array (
0 => 'Fri, 30 Dec 2016 11:18:35 GMT',
),
'Date' =>
array (
0 => 'Fri, 30 Dec 2016 11:18:35 GMT',
),
'Cache-Control' =>
array (
0 => 'private, max-age=0, must-revalidate, no-transform',
),
'Content-Disposition' =>
array (
0 => 'attachment',
),
'Vary' =>
array (
0 => 'Origin',
1 => 'X-Origin',
),
'Content-Type' =>
array (
0 => 'text/csv',
),
'X-Content-Type-Options' =>
array (
0 => 'nosniff',
),
'X-Frame-Options' =>
array (
0 => 'SAMEORIGIN',
),
'X-XSS-Protection' =>
array (
0 => '1; mode=block',
),
'Content-Length' =>
array (
0 => '0',
),
'Server' =>
array (
0 => 'GSE',
),
'Alt-Svc' =>
array (
0 => 'quic=":443"; ma=2592000; v="35,34"',
),
),
'protocol' => '1.1',
'stream' =>
GuzzleHttp\Psr7\Stream::__set_state(array(
'stream' => NULL,
'size' => NULL,
'seekable' => true,
'readable' => true,
'writable' => true,
'uri' => 'php://temp',
'customMetadata' =>
array (
),
)),
))

How can I get content of the file?

Figured it out.

To read content of an exported file, from the a GuzzleHttp\Psr7\Response, we should use:

$file = $service->files->export($fileId, 'text/csv', array(
        'alt' => 'media' ));
    $size = $file->getBody()->getSize();
    if($size > 0) {
        $content = $file->getBody()->read($size);
    }