I'm trying to test to see if a .flv video stream exists on my page before deciding if to display flowplayer or not. I thought i'd have a go at looking at the file headers to see if it was found or not (I dunno if this will actuatlly work)....using the following function:
function StreamRunning(){
$file_headers = @get_headers('http://12.34.56.789:1234/stream.flv');
if($file_headers[0] == 'HTTP/1.1 404 Not Found') { // HTTP/1.1 200 OK
return false;
}
else {
return true;
}
}
To test things i've hard coded in the URL of the stream. In reality this will be the public IP address of my computer streaming the video from VLC player, but for this demo i've replaced it with 12.34...etc..
The problem I'm getting is this function seems to cause a white page of death error, giving me no clue what's wrong. Not even anything in my log file. I guess there's two questions really,
- Is there something wrong with my function? Does get_headers not accept I/P addresses like that?
- Is there a better way I should be doing this anyway?
Thanks in advance!
Update: 13-3-11 11:03 (GMT) - If the .flv stream is actuatlly there the page loads fine, if the .flv stream is missing get_headers causes a white screen of death,even with all error reporting enabled, nothig in the log.