url;
$this->data = implode ("", file ($url));
}
function obtener_items (){
preg_match_all ("/- .*<\/item>/xsmUi", $this->data, $matches);
$items = array ();
foreach ($matches[0] as $match){
$items[] = new RssItem ($match);
}
return $items;
}
}
class RssItem {
var $title, $url, $description;
function RssItem ($xml){
$this->populate ($xml);
}
function populate ($xml){
preg_match ("/ (.*) <\/title>/xsmUi", $xml, $matches);
$this->title = $matches[1];
preg_match ("/ (.*) <\/link>/xsmUi", $xml, $matches);
$this->url = $matches[1];
preg_match ("/ (.*) <\/description>/xsmUi", $xml, $matches);
$this->description = $matches[1];
}
function obtener_titulo (){
return $this->title;
}
function obtener_url (){
return $this->url;
}
function obtener_descripcion (){
return $this->description;
}
}
foreach ($RSS->obtener_items () as $item){
printf ('%s
%s
',
$item->obtener_url (), $item->obtener_titulo (), $item->obtener_descripcion ());
}
?>