Check if youtube video is still valid – YouTube API
August 6th, 2009
1 comment
fast PHP function to check if youtube video is still valid:
<?php
function checkYoutubeId($id) {
if (!$data = @file_get_contents("http://gdata.youtube.com/feeds/api/videos/".$id)) return false;
if ($data == "Video not found") return false;
return true;
}
function checkYoutube($vid) {
if (strlen($vid) < 12) { return checkYoutubeId($vid); }
$preg1 = '@www.youtube.com\/watch\?v=(.*?)$@';
if ( preg_match($preg1, $vid, ...
Categories: Bookmarks, PhP, Tech check, Check yotube, id, PhP, script, valid youtube, youtube id, youtube php









