Hola, pues mis conocimientos en php son nulos, y estoy intentando hacer funcionar un script reemplazando los datos de Youtube por los de Dailymotion, pero no consigo hacer que funcione.
CÓDIGO ORIGINAL:
Código PHP:
<?php
$ytfeedURL = 'https://gdata.youtube.com/feeds/api/videos?q=trailer '.$movie_title.'+official+trailer&max-results=1&v=2';
$ytxml = simplexml_load_file($ytfeedURL);
foreach ($ytxml->entry as $entry) {
$media = $entry->children('http://search.yahoo.com/mrss/');
$attrs = $media->group->player->attributes();
$watch = $attrs['url'];
$attrs = $media->group->content->attributes();
$player = str_replace("https://www.youtube.com/v/", "", $attrs['url']);
}
echo"<iframe width='0' height='0' src='http://www.youtube.com/embed/$player?vq=hd720&autohide=1&autoplay=1&modestbranding=0&showinfo=0&rel=0&iv_load_policy=3' frameborder='0' allowfullscreen></iframe>";
?>
CÓDIGO CON MI FRACASO:
Código PHP:
<?php
$ytfeedURL = 'https://api.dailymotion.com/videos?search=trailer '.$movie_title.'+official+trailer&limit=1';
$ytxml = simplexml_load_file($ytfeedURL);
foreach ($ytxml->entry as $entry) {
$media = $entry->children('http://search.yahoo.com/mrss/');
$attrs = $media->group->player->attributes();
$watch = $attrs['id'];
$attrs = $media->group->content->attributes();
$player = str_replace("http://www.dailymotion.com/video/", "", $attrs['id']);
}
echo"<iframe width='0' height='0' src='http://www.dailymotion.com/embed/video/$player?autoPlay=1' frameborder='0' allowfullscreen></iframe>";
?>
Como se ve simplemente he modificado las URLS, el campo de los datos obtenidos (url por id) y el parametro max-results de youtube por el limit de dailymotion.
¿Alguien puede echarme una mano o decirme donde está el fallo?
Lo agradeceria mucho, saludos compañeros.