channel->title; $channel['link'] = $xml->channel->link; $channel['description'] = $xml->channel->description; $channel['pubDate'] = $xml->channel->pubDate; $channel['timestamp'] = strtotime($xml->channel->pubDate); echo '

' . $channel['title'].PHP_EOL; echo ''.PHP_EOL; echo ''.PHP_EOL; echo ''.PHP_EOL; echo '

'.PHP_EOL; $cpt=0; foreach ($xml->channel->item as $item) { $article = array(); $article['title'] = $item->title; $article['link'] = $item->link; $article['link'] = re_remove($article['link'], '/#xtor=RSS-(.+)/'); $article['pubDate'] = $item->pubDate; $article['timestamp'] = strtotime($item->pubDate); $article['description'] = $item->description; $article['image'] = $item->enclosure['url']; $articles[$cpt] = $article; echo '
'.PHP_EOL; echo '

'.PHP_EOL; echo '  '.PHP_EOL; echo ' '.PHP_EOL; echo $article['title'].'  '.PHP_EOL; echo '
'.PHP_EOL; $cpt++; if( $cpt > $NEWS_RSS_MAX_ITEMS ) { break; } } } echo ''; echo '
'; echo '
'; echo '
'.PHP_EOL; $cpt=0; foreach ($articles as $article ) { $cpt_prev=$cpt-1; $cpt_next=$cpt+1; echo ''; echo "
\n"; echo "
"; echo ""; $article_content = file_get_contents($article['link']); $article_content_utf8 = mb_convert_encoding($article_content, 'HTML-ENTITIES', "UTF-8"); $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; $doc->formatOutput = true; $libxml_previous_state = libxml_use_internal_errors(true); $doc->loadHTML($article_content_utf8); libxml_clear_errors(); libxml_use_internal_errors($libxml_previous_state); $articles = $doc->getElementsByTagName('article'); $article_only=""; foreach ( $articles as $node) { $article_only = DOMinnerHTML($node); } $orgStrings = array(' href="/'); $newStrings = array(' href="https://www.francetvinfo.fr/'); $article_only = str_replace($orgStrings, $newStrings, $article_only); $orgStrings = array(' src="/'); $newStrings = array(' src="https://www.francetvinfo.fr/'); $article_only = str_replace($orgStrings, $newStrings, $article_only); $orgStrings = array(' data-src="/'); $newStrings = array(' data-src="https://www.francetvinfo.fr/'); $article_only = str_replace($orgStrings, $newStrings, $article_only); $orgStrings = array( '

', '

', '', '

', '
', '

', '

', '

', '

', '

', '

', '

', 'Le Monde', '
', '', '

', '', '', '

', '
', '
', '

', '

', '

', '

', '

', 'Le Monde', '
', '', $article_only); $re = '//'; $article_only = preg_replace($re, '', $article_only); $re = '/', $article_only); $article_only = re_remove($article_only, '/(.+?)class="avatar"><\/span>/'); $article_only = re_remove($article_only, '/<\/a>/'); $article_only = re_remove($article_only, '/onclick="FTVi\.countClick\(\'(.+?)\)(;"|")/'); $article_only = re_remove($article_only, '/Votre avis est précieux\.<\/span>

Aidez-nous à améliorer notre site en répondant à notre questionnaire\.<\/p>/'); $article_only = re_remove($article_only, '/

je donne mon avis<\/div><\/a>/'); $article_only = re_remove($article_only, '/
<\/div/'); $article_only = re_remove($article_only, '/