<!-- this is an example of how the news_parser_4.php can be used. -->
<!-- try it. you might like it. -->
<? include ("news_parser_4.php"); ?>
<html>
<title>Moreover news parse example</title>
<body bgcolor="white">
<!-- search form -->
<form name="moreover_search">
Enter in some key words to search moreover.com<br>
<input type="text" name="search_str" value="<? echo $search_str; ?>">
<input type="hidden" name="action" value="search">
<input type="submit" name="search" value="search">
</form>
<?
// ok run our search
if ($action=="search") {
// create a news parser
$xml_news_parser = new news_xml_parser("http://p.moreover.com/cgi-local/page?&k=". urlencode($search_str)."&o=xml");
// uh, tell it to parse
$xml_news_parser->parse();
//free it up
$xml_news_parser->free_parser();
//ok now, just deal with the display
echo "<br><b>".count($xml_news_parser->news_objects)." results for $search_str</b><br clear=\"all\">\n";
echo "<table border=1 cellpadding=5 cellspacing=0>\n";
if (count($xml_news_parser->news_objects)>1){
foreach ($xml_news_parser->news_objects as $article) {
echo "<tr><td><a href=\"".$article->url."\">".$article->harvest_time."<br>".$article->headline_text." <a href=\"".$article->document_url."\">[".$article->source."]</a>\n</td></tr>";
}
}
else {
echo "<tr><td>No articles found</td></tr>";
}
}
?>
</table>
</body>
</html>
|