使用PHP和curl获取远程FLV

时间:2009-12-06 15:41:35

标签: php curl exec

我想知道是否可以使用PHP和exec函数获取远程flv文件并使其“流”。我在我的环境中“卷曲”,所以我想要这样的东西:

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

问题是$ out作为数组返回;我想输出curl返回的'raw'流。

1 个答案:

答案 0 :(得分:1)

您应该可以使用fpassthru(),但最好只是将用户重定向到正确的网址。

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

或重定向:

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

想想看,你甚至可以使用readfile()

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

无论如何,如果您只是重定向用户,请执行此操作。它的效率更高。

相关问题