Disco
Disco

Reputation: 4386

Get a remote FLV using PHP and curl

I want to know if it's possible 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.

Upvotes: 0

Views: 965

Answers (1)

Josh Davis
Josh Davis

Reputation: 28730

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.

Upvotes: 1

Related Questions