Im using this code to publish a feed of our blog's RSS but its not working and I can't figure out why. It used to work until a month or so ago (i just realized its not working anymore). I'm thinking it could be because a higher version of php doesn't recognize one of the commands - but i'm not sure. hence why im asking for your help $url= $this->get_template_vars('myurl'); $feed = file_get_contents($url); if ($feed <> false) { $rss = new SimpleXmlElement($feed); $i = 0; foreach($rss->channel->item as $entry) { if ($i >=3) { break; } else { echo "<div class='HomepageArticlesWrapper'><p><a href='$entry->link' title='$entry->title'>" . $entry->title . "</a></p>"; echo "<p>" . $entry->description . "</p></div>"; $i += 1; } } } Code (markup):
I dont have error reporting turned on. Im using this in a Smarty file so this is the entire code: {assign var="myurl" value=$smarty.const.SITE_RSS} {php} $url= $this->get_template_vars('myurl'); $feed = file_get_contents($url); if ($feed <> false) { $rss = new SimpleXmlElement($feed); $i = 0; foreach($rss->channel->item as $entry) { if ($i >=3) { break; } else { echo "<div class='HomepageArticlesWrapper'><p><a href='$entry->link' title='$entry->title'>" . $entry->title . "</a></p>"; echo "<p>" . $entry->description . "</p></div>"; $i += 1; } } } {/php} Code (markup):
This is what i get Warning: file_get_contents() [function.file-get-contents]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in/usr/home/path... on line 39 Warning: file_get_contents(http://feeds.feedburner.com/Feed) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in/usr/home/path... on line 39 Notice: Undefined index: PRACTICE in/usr/home/path... on line 51 Code (markup):
Your hosting provider/server administrator will need to enable allow_url_fopen. http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen