add listes sources a appel.php

master
Bastien OLLIER 3 years ago
parent a31aa1b419
commit cbad497b4e

@ -1,7 +1,6 @@
<?php
class RssParser
{
public function getResultFlux($url)
{
ini_set('display_errors', 1);
@ -19,10 +18,6 @@ class RssParser
$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;

@ -1,12 +1,29 @@
<html>
w<html>
<body>
<?php
include("news.php");
include ('RssParser.php');
include("gatewayNews.php");
include("gatewaySources.php");
include ("config.php");
$parser = new RssParser();
$gatewayNew = new gatewayNews($con);
$gatewaySource = new gatewaySources($con);
$listeSources = $gatewaySource->getSources();
foreach($listeSources as $source){
echo $source;
$resultFlux = $parser->getResultFlux($source);
foreach($resultFlux as $n){
$gateNews->addNews($n);
}
}
/*
$resultFlux = $parser->getResultFlux("https://www.lemonde.fr/sciences/rss_full.xml");
foreach($resultFlux as $n){
$gateNews->addNews($n);
echo $n->getTitle();
echo "</br>";
echo $n->getPubdate();
@ -17,7 +34,7 @@ foreach($resultFlux as $n){
echo "</br>";
echo "</br>";
}
*/
?>
</body>
</html>

@ -1,4 +1,5 @@
<?php
include("connection.php");
//préfixe
$rep=__DIR__.'/../';
//BD

Loading…
Cancel
Save