diff --git a/RssParser.php b/RssParser.php new file mode 100644 index 0000000..dd0a17b --- /dev/null +++ b/RssParser.php @@ -0,0 +1,31 @@ +channel->item as $item) + { + $title = $item->title; + $description = $item->description; + $pubdate = $item->pubDate; + $link = $item->link; + $listeArticles[] = new News($title,$description,$pubdate,$link); + + // Create summary as a shortened body and remove images, + // extraneous line breaks, etc. + //$post->summary = $this->summarizeText($post->text); + } + + return $listeArticles; + } +} +?> diff --git a/appel.php b/appel.php new file mode 100644 index 0000000..c2cf883 --- /dev/null +++ b/appel.php @@ -0,0 +1,23 @@ + + +getResultFlux("https://www.lemonde.fr/sciences/rss_full.xml"); +foreach($resultFlux as $n){ + echo $n->getTitle(); + echo "
"; + echo $n->getPubdate(); + echo "
"; + echo $n->getLink(); + echo "
"; + echo $n->getDescription(); + echo "
"; + echo "
"; +} + +?> + + diff --git a/news.php b/news.php index dacfb9b..ad0ddec 100644 --- a/news.php +++ b/news.php @@ -1,4 +1,5 @@ link; } - } ?>