I have an flv file, and I would like to stream it over php, atm I have the following code :
UPDATED CODE
this is the code I copied from phihag, but now the code doesnt download the file, it returns and empty file!
$file = $_GET['url'];
if ((substr($file, 0, 7) != 'http://') && (substr($file, 0, 8) != 'https://')) {
die('You have to specify an HTTP URL');
}
$f = fopen($file, "rb"); // b is required on Windows
if ($f !== false) {
header('Content-Description: File Transfer');
header('Content-Type: application/flv');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
$f = fopen($_GET['file'], "r");
while(!feof($f)) {
echo fread($f,8192);
}
fclose($f);
exit;
}
the code above doesnt work, for some reason it doesnt get passed the if statement, and when I remove the ifstatement it downloads an empty file!!! note that the file is stored on a remote server that I have no access to.
Thanks
if (fopen($url, "r")) {uses a variable$urlwhich is not defined in this program. You probably want: