I've been expermenting with loading RSS feeds with PHP but I'm stuck on one problem:
If the feed doesn't exist I want to display a "user friendly" error but when I use this code, it also brings back the "server error".
Any way around this, so it just shows my own error message?
$content = file_get_contents('http://www.site.com/feed.xml');
if(empty($content)){
echo 'ERROR: Couldn\'t load feed';
}
else{
$rss = new SimpleXmlElement($content);
echo '<h1><a href="' .$rss->channel->item->link. '">' .$rss->channel->item->title. '</a></h1>';
}