File: show_news.php

Recommend this page to a friend!
  Classes of Carter Comunale  >  news_parser_4  >  show_news.php  >  Download  
File: show_news.php
Role: ???
Content type: text/plain
Description: This is an example of how the news can be parsed
Class: news_parser_4
Author: By
Last change:
Date: 19 years ago
Size: 1,612 bytes


Class file image Download
<!-- 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"); ?>
<title>Moreover news parse example</title>
<body bgcolor="white">

<!-- search form -->
<form name="moreover_search">

Enter in some key words to search<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">

// ok run our search
if ($action=="search") {

         // create a news parser
        $xml_news_parser = new news_xml_parser("". urlencode($search_str)."&o=xml");
        // uh, tell it to parse
        //free it up

        //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."&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".$article->document_url."\">[".$article->source."]</a>\n</td></tr>";

        else {
                echo "<tr><td>No articles found</td></tr>";


For more information send a message to info at phpclasses dot org.