public function MediaInternetYouTubeHandler::valid_id in Media: YouTube 7
1 call to MediaInternetYouTubeHandler::valid_id()
File
- includes/
MediaInternetYouTubeHandler.inc, line 25
Class
- MediaInternetYouTubeHandler
- Implementation of MediaInternetBaseHandler.
Code
public function valid_id($id) {
$url = 'http://gdata.youtube.com/feeds/api/videos/' . $id;
$response = drupal_http_request($url, array(
'method' => 'HEAD',
));
if ($response->code == 401) {
throw new MediaInternetValidationException("Embedding has been disabled for this video.");
}
elseif ($response->code != 200) {
throw new MediaInternetValidationException("The YouTube video ID is invalid or the video was deleted.");
}
return TRUE;
}