Questo è il link degli RSS che voglio includere nel mio sito: http://www.repubblica.it/rss/homepage/rss2.0.xml
Volevo sapere come leggere il tag enclosure. Ho usato il codice trovato su php.html.it
Codice PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Feed</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php include_once('XML_RSS_EXTENSION.php') ; $webNews=&new XML_RSS_ext20('http://www.repubblica.it/rss/homepage/rss2.0.xml') ; $webNews->parse() or die('Lettura impossibile') ; $channel= $webNews->getChannelInfo() ; $news= $webNews->getItems() ; $logo= $webNews->getImages() ; /* $webNews->getImages() restituisce un array moultidimensionale di tutte le immagini presenti e dei rispettivi dati, nel nostro caso esiste una sola immagine. */ $logo= $logo[0] ; $output = '' ; $output = '[img]'.$logo['url'].'[/img]' ; $output .= '<h1 style="margin-bottom: 0 ; font-size: 14pt">'.$channel['title'].'</h1>'.$channel['link'].'
' ; $output .= '<h2 style="margin-top: 10px ; margin-bottom: 0 ; font-size: 13pt">'.$channel['description'].'</h2>' ; $output.= 'Aggiornato il '.date('d.m.Y \a\l\l\e \o\r\e H:i', strtotime($channel['pubdate'])).'
' ; /* Scorriamo le news */ foreach($news as $n ){ $output.= "- <a href=\"{$n['link']}\" target=\"_blank\">{$n['title']}</a>
" ; $output.=$n['description'].'
' ; } echo($output) ; ?> </body> </html>