How to redirect a live data stream adding to it another header and returning it on demand? (PHP)

Posted by Ole Jak on Stack Overflow See other posts from Stack Overflow or by Ole Jak
Published on 2010-05-23T19:26:40Z Indexed on 2010/05/23 19:30 UTC
Read the original article Hit count: 198

Filed under:
|
|
|
|

I have a url like http://localhost:8020/stream.flv

On request to my php sctipt I want to return (be something like a proxy) all data I can get from that URL (so I mean my php code should get data from that url and give it to user) and my header and my beginning of file.

So I have my header and some data I want to write in the beginning of response like

# content headers
        header("Content-Type: video/x-flv");
        header("Content-Disposition: attachment; filename=\"" . $fileName . "\"");
        header("Content-Length: " . $fileSize);

        # FLV file format header
        if($seekPos != 0) 
        {
        print('FLV');
        print(pack('C', 1));
        print(pack('C', 1));
        print(pack('N', 9));
        print(pack('N', 9));
    }

How to do such thing?

© Stack Overflow or respective owner

Related posts about php

Related posts about server