开发者

wrapper_data is empty?

I have a php script to retrieve headers using cURL, as described on this link. This works great on a localhost, but when I try to run the exact same script on another host, it will return a similar array, except for the array wrapper_data which is unfortunately the section I need (I'm trying to figure out if a url is an mp3 file).

Local returns

Array
(
    [0] => 
)
Array
(
    [wrapper_data] => Array
        (
            [0] => HTTP/1.1 200 OK
            [1] => Server: nginx
            [2] => Date: Thu, 14 Jul 2011 02:46:34 GMT
            [3] => Content-Type: audio/mpeg
            [4] => Connection: close
            [5] => Last-Modified: Thu, 22 Oct 2009 16:19:38 GMT
            [6] => Expires: Fri, 13 Jul 2012 02:46:34 GMT
            [7] => Content-Length: 5103556
            [8] => X-hawt: very
            [9] => X-Orig-Src: 0_mogord
            [10] => X-nc: HIT ord 9
            [11] => Accept-Ranges: bytes
            [12] => Cache-Control: max-age=31536000
        )

    [wrapper_type] => http
    [stream_type] => tcp_socket/ssl
    [mode] => r
    [unread_bytes] => 0
    [seekable] => 
    [uri] => http://takethesongsandrun.files.wordpress.com/2009/10/proud-graduates.mp3
    [timed_out] => 
    [blocked] => 1
    [eof] => 

but the host returns

Array
(
    [0] => 
)
Array
(
    [wrapper_data] => Array
        (
            [headers] => Array
                (
                )

            [readbuf] => Resource id #14
        )

    [wrapper_type] => cURL
    [stream_type] => cURL
    [mode] => r
    [unread_bytes] => 0
    [seekable] => 
    [uri] => http://thedadada.files.wordpress.com/2011/06/06-pulling-on-a-line.mp3
    [timed_out] => 
    [blocked] => 1
    [eof] => 

I know cURL is not the problem, as it works in other places on my site. Is there some开发者_Python百科thing preventing this information from being retrieved properly?


What I discovered is that the cUrl wrapper won't return the headers until you've used fread() on the handle

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜