ho usato questo modificando l'indirizzo del feed:
Codice PHP:
<ul><?php
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
function startElement($parser, $name, $attrs) {
global $insideitem, $tag, $title, $description, $link;
if ($insideitem) {
$tag = $name;
} elseif (strtolower($name) == "item") {
$insideitem = true;
}
}
function endElement($parser, $name) {
global $insideitem, $tag, $title, $description, $link;
if (strtolower($name) == "item") {
printf("<li><strong><a href='%s' title='Leggi: %s' target='_blank'>%s</a></strong><br />",
trim($link),trim($title),trim($title));
printf("%s</li>",trim($description));
$title = "";
$description = "";
$link = "";
$insideitem = false;
}
}
function characterData($parser, $data) {
global $insideitem, $tag, $title, $description, $link;
if ($insideitem) {
switch (strtolower($tag)) {
case "title":
$title .= $data;
break;
case "description":
$description .= $data;
break;
case "link":
$link .= $data;
break;
}
}
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
// Carico indirizzo feed rss delle news
$fp = fopen("http://dauniacom.altervista.org/wordpress/?feed=atom","r")
or die("Error reading RSS data.");
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);
?></ul>