Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to fetch and display a feed from my blog
    text
    copied!<p>I am trying to fetch the rss feed from my blog and display the most recent 5 posts into my website, the php code that I am using is shown below</p> <pre><code>&lt;?php $rss = new DOMDocument(); $rss-&gt;load('http://blog.techbreeze.in/feed/'); $feed = array(); foreach ($rss-&gt;getElementsByTagName('item') as $node) { $item = array ( 'title' =&gt; $node-&gt;getElementsByTagName('title')-&gt;item(0)-&gt;nodeValue, 'desc' =&gt; $node-&gt;getElementsByTagName('description')-&gt;item(0)-&gt;nodeValue, 'link' =&gt; $node-&gt;getElementsByTagName('link')-&gt;item(0)-&gt;nodeValue, 'date' =&gt; $node-&gt;getElementsByTagName('pubDate')-&gt;item(0)-&gt;nodeValue, ); array_push($feed, $item); } $limit = 5; for($x=0;$x&lt;$limit;$x++) { $title = str_replace(' &amp; ', ' &amp;amp; ', $feed[$x]['title']); $link = $feed[$x]['link']; $description = $feed[$x]['desc']; $date = date('l F d, Y', strtotime($feed[$x]['date'])); echo '&lt;p&gt;&lt;strong&gt;&lt;a href="'.$link.'" title="'.$title.'"&gt;'.$title.'&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;'; echo '&lt;small&gt;&lt;em&gt;Posted on '.$date.'&lt;/em&gt;&lt;/small&gt;&lt;/p&gt;'; echo '&lt;p&gt;'.$description.'&lt;/p&gt;'; } ?&gt; </code></pre> <p>The trouble is, the code works just fine when i test it on my local server which is running WAMP, but when I upload it to the production server, which is linux based and running Centos and test it I am getting strange errors which I don't understand why. The errors I am getting are</p> <blockquote> <p>Warning: DOMDocument::load() [domdocument.load]: Document is empty in <a href="http://blog.techbreeze.in/feed/" rel="nofollow">http://blog.techbreeze.in/feed/</a>, line: 1 in /home/<strong><em></strong>/</em><strong>*</strong>/blog.php on line 4</p> <p>Warning: DOMDocument::load() [domdocument.load]: Start tag expected, '&lt;' not found in <a href="http://blog.techbreeze.in/feed/" rel="nofollow">http://blog.techbreeze.in/feed/</a>, line: 1 in /home/<strong><em></strong>/</em><strong>*</strong>/blog.php on line 4</p> </blockquote> <p>Please help me understand what is wrong and how to solve this.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload