Quantcast
Channel: Parsing RSS Feed with SimpleXML - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Parsing RSS Feed with SimpleXML

$
0
0

When I Run this code:

<?php
$rss = simplexml_load_file('http://stackoverflow.com/feeds');
?>
<h1><?php echo $rss->title; ?></h1>
<ul>
<?php
foreach($rss->entry as $e) {
    echo "<li><a href=\"".$e->link['href']."\">";
    echo $e->title;     
    echo "</a></li>\n";
}    
?>
</ul>

It generate following error:

Warning: simplexml_load_file(http://stackoverflow.com/feeds) [function.simplexml-load-file]: failed to open stream: Permission denied in /home/www/cheapflightshunt.co.uk/aaaa.php on line 2

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://stackoverflow.com/feeds" in /home/www/cheapflightshunt.co.uk/aaaa.php on line 2

Warning: Invalid argument supplied for foreach() in /home/www/cheapflightshunt.co.uk/aaaa.php on line 7

My shared hosting is running with PHP5.2.17

Please provide the solution.

Thanks in advance.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images