// RSS NEWS READER
// Simple RSS Reader to grab news from whichever site you choose from a select box
// I've included a few popular RSS News Feeds, but add your own using the listbox
// Easy As.
?>
|
";
printf(" %s ", // make our title into an actual link
trim($link),htmlspecialchars(trim($title))); // remove html characters from the title
echo " |
";
echo "
| ";
printf(" %s ",$description); // Print out the live journal entry
echo" | ";
echo "
";
echo "";
echo "
";
$title = $description = $link = $insideitem = false;
}
}
// Now to the parsing itself. Starts by creating it:
$xml_parser = xml_parser_create();
// Then setup the handlers:
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
// Open the actual datafile:
$fp = fopen($backend, r);
// Run through it line by line and parse:
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)));
}
// Close the datafile
fclose($fp);
// Free any memmory used
xml_parser_free($xml_parser);
?>