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'] . '
';
$cpt=0;
foreach ($xml->channel->item as $item) {
$article = array();
$article['title'] = $item->title;
$article['link'] = $item->link;
$article['pubDate'] = $item->pubDate;
$article['timestamp'] = strtotime($item->pubDate);
$article['description'] = $item->description;
$SEARCH_SUB1='
description, $SEARCH_SUB2, $pos_start);
$height=substr($item->description, $pos_start, $pos_stop - $pos_start);
$article['width']=1024;
$article['height']=$height;
$SEARCH_SUB1='src="';
$pos_start = strpos($item->description, $SEARCH_SUB1);
$pos_start += strlen($SEARCH_SUB1);
$SEARCH_SUB2="\"";
$pos_stop = strpos($item->description, $SEARCH_SUB2, $pos_start);
$article['image']=$item->mediacontent['url'];
$articles[$cpt] = $article;
echo '
'.PHP_EOL;
echo '

'.PHP_EOL;
echo '
'.PHP_EOL;
echo '
';
echo $article['title'].' '.PHP_EOL;
echo '
'.PHP_EOL;
$cpt++;
if( $cpt > $NEWS_RSS_MAX_ITEMS ) {
break;
}
}
}
echo ''.PHP_EOL;
echo ''.PHP_EOL;
echo ''.PHP_EOL;
echo ''.PHP_EOL;
echo '
'.PHP_EOL;
echo '
'.PHP_EOL;
echo '
'.PHP_EOL;
$cpt=0;
foreach ($articles as $article ) {
$cpt_prev=$cpt-1;
$cpt_next=$cpt+1;
echo PHP_EOL.PHP_EOL."".PHP_EOL;
echo "
\n";
echo "
";
echo "
\n";
$article_content = file_get_contents($article['link']);
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$libxml_previous_state = libxml_use_internal_errors(true);
$doc->loadHTML($article_content);
libxml_clear_errors();
libxml_use_internal_errors($libxml_previous_state);
$articles = $doc->getElementsByTagName('article');
foreach ( $articles as $node) {
$article_only = DOMinnerHTML($node);
}
$orgStrings = array( '
',
' width="500" height="281" frameborder="0" ');
$newStrings = array( '
Lire aussi :';
$pos_stop = strpos($article_only, $SEARCH_SUB1);
if($pos_stop) {
$temp = substr($article_only, 0, $pos_stop);
$article_only = $temp."";
} else {
//End of article cleanup
$SEARCHSUB='';
$pos_stop=false;
$pos_stop = strpos($article_only, $SEARCHSUB);
if($pos_stop) {
$temp = substr($article_only, 0, $pos_stop);
$article_only = $temp;
} else {
$SEARCHSUB='';
$pos_stop=false;
$pos_stop = strpos($article_only, $SEARCHSUB);
if($pos_stop) {
$temp = substr($article_only, 0, $pos_stop);
$article_only = $temp;
} else {
DEBUG("Article($cpt) : No Match");
}
}
}
$re = '/alt="(.+?)" width="(.+?)" height="(.+?)"/';
$temp = preg_replace($re, 'width="100%"', $article_only);
$article_only = $temp;
$re = '/alt="" width="(.+?)" height="(.+?)"/';
$temp = preg_replace($re, 'width="100%"', $article_only);
$article_only = $temp;
$re = '/
',
'
',
'
',
'
');
$newStrings = array(
'',
'',
'',
'');
$article_only = str_replace($orgStrings, $newStrings, $article_only);
// Cleanup "Social"
$re='/