0
Je veux faire un filtre pour mes nouvelles RSS en utilisant simplepie. J'ai donc ce code:rss flux filtre simplepie
$feed = new SimplePie();
$feed->set_feed_url(http://rss);
$feed->init();
$feed->set_cache_duration (3600);
$feed->set_timeout(30);
$feed->handle_content_type();
$countItem = 0;
foreach ($feed->get_items() as $item){
$checktitle = $item->get_permalink();
//Regex keyword filter
$pattern = '/keyword1|keyword2/';
//If the there is a keyword match, store in $matches array
if (preg_match($pattern, $checktitle)) {
$news[$countItem]= $item;
$countItem++;
}
}
Je veux $ nouvelles pour contenir les deux mots-clés non seulement un ou l'autre.