Ya logré que funcione... Metiendo el archivo dentro de la librería, pero el problema es que hay que realizar peticiones ajax para comprobar si el video existe. Entonces, al cargar la página.. se van mostrando a saltos, es decir, van apareciendo poco a poco. ¿Esto puede resultar malo para el servidor?. Lo digo por si puede sobrecargarse o algo...
La función es esta... se ejecuta unas 20 veces al mostrar la página. Bucle While con id diferentes.
Código PHP:
Ver originalrequire_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
function get_yt_vname($chk_id){
//Check if video exists
$videoEntryUrl='http://gdata.youtube.com/feeds/api/videos/'.$chk_id;
$cl=new Zend_Http_Client($videoEntryUrl);
$i=0;
while ((!isset($status) or
$status!==200) and
$i<3){ //because of sometimes 503 server error, even if video exists $response = $cl->request();
$status=$response->getStatus();
$i++;
}
if ($status===200){
$body=$response->getBody();
Zend_Loader::loadClass('Zend_Gdata_YouTube');
$vE=new Zend_Gdata_YouTube_VideoEntry();
//var_dump($vE);
$vE->transferFromXML($body);
return $vE->getVideoTitle();
}else{
return false;
}
}
Saludos.