Ver ❯
Herramientas SEO
Tamaño del resultado:
668 x 574
×
Cambiar Orientacion
Cambiar tema, Oscuro/Luz
<!doctype html> <html lang="es"> <head> <meta charset="utf-8"> <title>Como extraer y convertir el contenido de un RSS a HTML con PHP</title> </head> <body> <?php function feed($feedURL){ $i = 0; $url = $feedURL; $rss = simplexml_load_file($url); foreach($rss->channel->item as $item) { $link = $item->link; //extrae el link $title = $item->title; //extrae el titulo $date = $item->pubDate; //extrae la fecha $guid = $item->guid; //extrae el link de la imagen $description = strip_tags($item->description); //extrae la descripcion if (strlen($description) > 600) { //limita la descripcion a 600 caracteres $stringCut = substr($description, 0, 300); $description = substr($stringCut, 0, strrpos($stringCut, ' ')).'...';} if ($i < 21) { // extrae solo 21 items echo '<div class="feed"><h2><a href="'.$link.'" target="_blank">'.$title.'</a></h2><br><img src="'.$guid.'"><br>'.$description.'<br><div class="time">'.$date.'</div></div>';} $i++;} echo '<div style="clear: both;"></div>';} ?> <?php feed("https://tutorialesenlinea.futbolgratis.org/rss.xml") ?> <center><object type="text/html" data="https://tutorialesenlinea.futbolgratis.org/ads/ads.html" frameborder="0" allowfullscreen width="100%" height="100%"></object></center> </body> </html>