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; $SEARCHREF="?ref=rss"; //Remove reference from links $posref=strpos($article['link'], $SEARCHREF); if( $posref ) { $article['link'] = substr($article['link'],0,$posref); } $article['pubDate'] = $item->pubDate; $article['timestamp'] = strtotime($item->pubDate); $article['description'] = $item->description; $article['image']=$item->mediacontent['url']; $articles[$cpt] = $article; echo '
'; echo '  '; echo ' '; echo $article['title'].'  '; echo '
'; $cpt++; if( $cpt > $NEWS_RSS_MAX_ITEMS ) { break; } } } 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 ''; echo "
\n"; echo "
"; echo ""; $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'); $article_only=""; if( isset( $articles[0] ) ) { $article_only=DOMinnerHTML($articles[0]); } //Clean some sections //$article_only = re_remove($article_only, '//'); $article_only = re_remove($article_only, '/

Most Viewed in (.+)<\/h2><\/header>/'); $article_only = re_remove($article_only, '/
<\/span>Loading<\/span><\/span><\/div><\/section><\/div>/'); $article_only = re_remove($article_only, '/
License this article<\/a><\/div>/'); $article_only = re_remove($article_only, '/

Our new podcast series from the team behind Phoebe\'s Fall<\/p>/'); $article_only = re_remove($article_only, '/

A relationship banned under traditional law.<\/p>/'); $article_only = re_remove($article_only, '/

<\/div><\/section>/'); $article_only = re_remove($article_only, '/