","",$rss_content); $rss_content = str_replace("","",$rss_content); $articles = array(); $xml = simplexml_load_string($rss_content); if ($xml === false) { echo 'Failed to read RSS'; } else { $channel = array(); $channel['title'] = $xml->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; $article['content'] = $item->contentEncoded; //Extract image $re = '/(.+?)/'; preg_match($re, $article['content'], $matches); if( isset($matches[2]) ) { $article['image'] = $matches[2]; if ( 0 == strlen($article['image']) ) { $re = '/(.+?)/'; preg_match($re, $article['content'], $matches); $article['image'] = $matches[2]; } } else { $article['image'] = ""; } $articles[$cpt]=$article; echo '
'; echo '
'; echo '  '; echo ' '; echo $article['title'].'  '; echo '
'; $cpt++; if( $cpt > $NEWS_RSS_MAX_ITEMS ) { break; } } } echo ''; echo ''; echo ''; echo '
'; echo '
'; echo '