jeudi 8 décembre 2016

Laravel 5.1 + google drive API 3.0 download from google drive

I try download file from google drive using google drive API 3.0, but i don't understand how actually save file.

I do this: $content = $service->files->export($fileId, 'application/pdf', array( 'alt' => 'media' ))

And get:

GuzzleHttp\Psr7\Response Object
(
    [reasonPhrase:GuzzleHttp\Psr7\Response:private] => OK
    [statusCode:GuzzleHttp\Psr7\Response:private] => 200
    [headers:GuzzleHttp\Psr7\Response:private] => Array
        (
            [Expires] => Array
                (
                    [0] => Mon, 05 Dec 2016 19:39:38 GMT
                )

            [Date] => Array
                (
                    [0] => Mon, 05 Dec 2016 19:39:38 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] => application/vnd.openxmlformats-officedocument.wordprocessingml.document
                )

            [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] => 4312
                )

            [Server] => Array
                (
                    [0] => GSE
                )

            [Alt-Svc] => Array
                (
                    [0] => quic=":443"; ma=2592000; v="36,35,34"
                )

        )

    [headerNames:GuzzleHttp\Psr7\Response:private] => Array
        (
            [expires] => Expires
            [date] => Date
            [cache-control] => Cache-Control
            [content-disposition] => Content-Disposition
            [vary] => Vary
            [content-type] => Content-Type
            [x-content-type-options] => X-Content-Type-Options
            [x-frame-options] => X-Frame-Options
            [x-xss-protection] => X-XSS-Protection
            [content-length] => Content-Length
            [server] => Server
            [alt-svc] => Alt-Svc
        )

    [protocol:GuzzleHttp\Psr7\Response:private] => 1.1
    [stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object
        (
            [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #334
            [size:GuzzleHttp\Psr7\Stream:private] => 
            [seekable:GuzzleHttp\Psr7\Stream:private] => 1
            [readable:GuzzleHttp\Psr7\Stream:private] => 1
            [writable:GuzzleHttp\Psr7\Stream:private] => 1
            [uri:GuzzleHttp\Psr7\Stream:private] => php://temp
            [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
                (
                )
        )
)

I tried many things from documentation by GuzzleHttp, but they didn't work...

Please help me to know what I must to do to download file.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire