I have a script that 'proxys' a .flv file from a .htaccess protected
folder. The proxying script is being called by a Flash flv player in
the main webpage.
This script works wonderfully in Firefox and co, but not at all in
Internet Explorer.
Proxy Script minus all the authentication gubbins...
function getRemoteFileSize($url)
{
$parsed = parse_url($url);
$host = $parsed["host"];
$fp = @fsockopen($host, 80, $errno, $errstr, 20);
if(!$fp)return false;
else {
@fputs($fp, "HEAD $url HTTP/1.1\r\n");
@fputs($fp, "HOST: $host\r\n");
@fputs($fp, "Connection: close\r\n\r\n");
$headers = "";
while(!@feof($fp))$headers .= @fgets ($fp, 128);
}
@fclose ($fp);
$return = false;
$arr_headers = explode("\n", $headers);
foreach($arr_headers as $header) {
$s = "Content-Length: ";
if(substr(strtolower ($header), 0, strlen($s)) == strtolower($s))
{
$return = trim(substr($header, strlen($s)));
break;
}
}
}
$proxyURL = $_GET['url'];
header('Content-type: video/x-flv');
header('Content-length: '.getRemoteFileSize($proxyURL));
$src = fopen($proxyURL, 'r');
$out = fopen('php://output', 'w');
stream_copy_to_stream($src, $out);
fclose($src);
fclose($out);
As I said, this works fine in FF but not IE. Could anyone make any
suggestions as to why this could be? Perhaps some Header issues?
TIA