Как получить длину содержимого Content-Disposition (вложение) - PullRequest
0 голосов
/ 06 февраля 2019

Можно ли получить контент-длину вложенного файла?

У меня есть эта ссылка https://clubdia.dia.es/folletos.html?action=descargarPDF&id=3729 URL-адрес, который содержит вложенный файл PDF

[Content-Disposition] => Array
(
[0] => attachment;filename=folleto.pdf
)

Когда я пытаюсь свернуть PHP, чтобы получить заголовки, я не получаю контент-длина, есть ли способ получить их?

Вот мой вывод, пытающийся запрос HEAD этого URL

GuzzleHttp\Psr7\Response Object
(
    [reasonPhrase:GuzzleHttp\Psr7\Response:private] => OK
    [statusCode:GuzzleHttp\Psr7\Response:private] => 200
    [headers:GuzzleHttp\Psr7\Response:private] => Array
        (
            [Server] => Array
                (
                    [0] => nginx
                )

            [Date] => Array
                (
                    [0] => Wed, 06 Feb 2019 15:20:36 GMT
                )

            [Content-Type] => Array
                (
                    [0] => application/octet-stream;charset=UTF-8
                )

            [Connection] => Array
                (
                    [0] => keep-alive
                )

            [Cache-Control] => Array
                (
                    [0] => public
                )

            [Content-Disposition] => Array
                (
                    [0] => attachment;filename=folleto.pdf
                )

            [Pragma] => Array
                (
                    [0] => public
                )

            [Strict-Transport-Security] => Array
                (
                    [0] => max-age=31536000; preload
                )

            [X-Cache] => Array
                (
                    [0] => HIT
                )

            [Set-Cookie] => Array
                (
                    [0] => visid_incap_1668516=zfz9ZeK+QDC92kl2iIG/xEP7WlwAAAAAQUIPAAAAAAD5iKB9ld5b9IMI9fwQ31Fc; expires=Thu, 06 Feb 2020 12:43:04 GMT; path=/; Domain=.dia.es
                    [1] => incap_ses_506_1668516=XR+cZwUqgm1tCCZhgK0FB0P7WlwAAAAAoiKqJJxl7/fK+lioQQ/p/g==; path=/; Domain=.dia.es
                    [2] => ___utmvmkRuIlDmB=dSHXhKBwkUI; path=/; Max-Age=900
                    [3] => ___utmvakRuIlDmB=wvuCjPl; path=/; Max-Age=900
                    [4] => ___utmvbkRuIlDmB=NZZ
                )

            [XhqOoalJ] => Array
                (
                    [0] => itB; path=/; Max-Age=900
                )

            [X-Iinfo] => Array
                (
                    [0] => 3-30525607-30525067 PNNN RT(1549466435409 36) q(0 0 0 0) r(0 0) U6
                )

            [X-CDN] => Array
                (
                    [0] => Incapsula
                )

        )

    [headerNames:GuzzleHttp\Psr7\Response:private] => Array
        (
            [server] => Server
            [date] => Date
            [content-type] => Content-Type
            [connection] => Connection
            [cache-control] => Cache-Control
            [content-disposition] => Content-Disposition
            [pragma] => Pragma
            [strict-transport-security] => Strict-Transport-Security
            [x-cache] => X-Cache
            [set-cookie] => Set-Cookie
            [xhqooalj] => XhqOoalJ
            [x-iinfo] => X-Iinfo
            [x-cdn] => X-CDN
        )

    [protocol:GuzzleHttp\Psr7\Response:private] => 1.1
    [stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object
        (
            [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #552
            [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
                (
                )

        )

)
...