My list of videos has grown too large. I run checks weekly on it to makes sure the videos are not dead and now the script stops in browser after a period of time. I run a dedicated server, but I don't want to raise my execution times. I would like it to show all the results on one page as I have it set to scroll to the bottom of the page. ( Matrix Style )
I'm just trying to get some guidance on the right direction.
<?
// Includes
include('db.php');
// Variables
$liveTotal = 0;
$deadTotal = 0;
// Query
$sql = "SELECT * FROM videos WHERE youtube <> '' ORDER BY id DESC";
$deadvideo = mysqli_query ($conn, $sql);
// Flush Buffer
ob_implicit_flush(true);
ob_end_flush();
while ($row = mysqli_fetch_assoc($deadvideo))
{
$video_url = @file_get_contents('https://www.youtube.com/oembed?format=json&url=http://www.youtube.com/watch?v=' . $row["youtube"]);
if(!$video_url)
{
// The code below will print all of the dead videos directly to your screen if uploaded in a public directory
$dead = '<font color="red"><strong>Dead video</strong></font> <a href="https://www.youtube.com/watch?v=' . $row["youtube"] . '">' . $row["title"] . '</a>';
echo $dead . '<br>';
$deadTotal++;
}
else
{
// The code below will print all of the live videos directly to your screen if uploaded in a public directory
$live = '<font color="darkgreen"><strong>Live video</strong></font> <a href="https://www.youtube.com/watch?v=' . $row["youtube"] . '">' . $row["title"] . '</a>';
echo $live . '<br>';
$liveTotal++;
}
};
echo '<br>' . '<strong>Scan Finished</strong>' . '<br>';
$total = $liveTotal+$deadTotal;
echo '<br>' . '<strong>Total Videos' . ': ' . $total;
echo '<br>' . '<strong><font color="darkgreen">Live Videos' . ': ' . $liveTotal . '</font>';
echo '<br>' . '<strong><font color="red">Dead Videos' . ': ' . $deadTotal . '</font>';
?>