I'm going to be hosting a video very soon that will be viewed pretty widely. I'm concerned that my host may not be able to handle the entire load for the video and wanted to know if there was a way in PHP to do an IF / ELSE statement. I would like to do something like: IF file is online, display fileA ELSE display fileB But I'm not sure how I can send in information to test if the connection is "online".
Can't you host the video with youtube, set it as private so no one can access it. Then use the code that they provide to embed it into your website?
Easy. I can do it if you want for pretty cheap. Use: <? $status = $row['status']; $source = $row['source']; $source2 = $row['source2']; if ( $status == 1 ) { echo "<embedcode123>$source</embedcode123>"; } else { echo "<embedcode123>$source2</embedcode123>"; } ?>
Adwords is talkin about database .. If youre gonna have that many peoples, i agree with the imvain2. YouTube would be capable of handling that kinda bandwidth. and like he said, set it to private so that nobody on YouTube can see it there. Then grab the <embed> source code they give ya ..and put that on your site. That way people coming to your site, still see the video on your site. but all bandwidth drain been routed to YouTube. - they like that probably. lol
Found/Figured something out, here is a brief snippet: <?php $url=("http://localhost/nameoffile.swf"); $file=@fopen($url, "r"); if ($file) { print("File available"); } else { print("File not available"); } fclose($fp); ?> PHP: It should be pretty easy from here. This snippet could be converted into other features such as cron job.
So this PHP file is on a server other than the one that is serving the video? You could use CURL to test if the URL returns a status 200 code.