如何获得内容处置(附件)的内容长度

时间:2019-02-06 15:32:14

标签: php curl http-headers http-content-length

是否可以获取附件的内容长度?

我有此链接https://clubdia.dia.es/folletos.html?action=descargarPDF&id=3729,它是一个包含附件pdf文件的网址

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

当我尝试在PHP上卷曲以获取标头时,我没有内容长度,是否有任何方法来获取标头?

这是我的输出尝试该URL的HEAD请求

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
                (
                )

        )

)

0 个答案:

没有答案