Skip to content

Instantly share code, notes, and snippets.

@evilnapsis
Created January 12, 2018 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evilnapsis/cbfc36f2aa87554728b4d6d240a70e33 to your computer and use it in GitHub Desktop.
Save evilnapsis/cbfc36f2aa87554728b4d6d240a70e33 to your computer and use it in GitHub Desktop.
Ejemplo de uso de SimplePie
<?php
include "simplepie-1.5/autoloader.php";
$url = "http://evilnapsis.com";
$s = new SimplePie();
$s->set_feed_url($url);
@$s->init();
echo "<h1>".$s->get_title()."</h1>";
echo "<h4>".$s->get_description()."</h4>";
for($i=0;$i<10;$i++){
$item = $s->get_item($i);
echo "<a href='".$item->get_link()."'>".$item->get_title()."</a>";
echo "<p>".$item->get_description()."</p>";
// echo $item->get_content();
echo "<p><i>Fecha y hora: ".$item->get_date("Y-m-d h:i:s")."</i></p>";
echo "<p>Autor: ".$item->get_author()->get_name()."</p>";
echo "<br>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment