开发者

Get a remote FLV using PHP and curl

开发者 https://www.devze.com 2022-12-13 20:04 出处:网络
I want to know if it\'s po开发者_如何转开发ssible to get a remote flv file and have it \'stream\' using PHP and exec function. I have \'curl\' in my environnement so i want something like :

I want to know if it's po开发者_如何转开发ssible to get a remote flv file and have it 'stream' using PHP and exec function. I have 'curl' in my environnement so i want something like :

exec ('curl http://myhosts.com/myflv.flv', $out);
print $out;

Problem is that $out is returned as an array; i want to output the 'raw' stream returned by curl.


You should be able to use fpassthru() for that, although it would probably be better to just redirect the user to the proper URL instead.

$fp = fopen('http://myhosts.com/myflv.flv', 'rb');
fpassthru($fp);

Or redirect:

header('Location: http://myhosts.com/myflv.flv');

Come to think of it, you should even be able to use readfile()

readfile('http://myhosts.com/myflv.flv');

At any rate, if you can simply redirect the user, do that. It's way more efficient.

0

精彩评论

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