I want to check if a YouTube video is working or not, I have tried to do that with PHP but it is not working. Can someone please help me solve this problem.
Here is my php code
<?php
function vaild( $header )
{
$headers = get_headers($header);
switch($headers[0]) {
case '200':
// video valid
return $header = 'video valid';
break;
case '403':
// private video
return $header = 'private video';
break;
case '404':
// video not found
return $header = 'video not found';
break;
default:
// nothing above
return $header = 'nothing above';
break;
}
}
echo vaild ('http://gdata.youtube.com/feeds/api/videos/qEDEyLjIEHE');
?>