
I made a tutorial a while back which parsed RSS feeds however it was really simple, in fact too simple…So here is a completely new script which parses the feeds in a completely different way.
So heres a walk-through of the script…
Firstly we need to represent the feed as an xml document. Using DOMDocument…More information here
$xmldoc = new DOMDocument();
Now we need to load the RSS Feed.
$xmldoc->load('RSS Feed Address');
Now the feed is loaded we need to make sure that each item in the feed is loaded individually.
foreach ($xmldoc->getElementsByTagName('item') as $feeditem) {
Now we need to show the feed. This will also show it as a link which the previous script didn’t do.
echo "getElementsByTagName('link')->item(0)->nodeValue . "\">“;
echo $feeditem->getElementsByTagName(’title’)->item(0)->nodeValue . “
\n”;
}
That snippet of code looks complicated however if you break it down its very simple. It’s just a hyperlink in HTML with PHP in the middle.
Demo - Using The Flick Zone Feed
Heres a full Source code for you copy and pasters out there….
load('RSS Feed Address');
foreach ($xmldoc->getElementsByTagName('item') as $feeditem) {
echo "getElementsByTagName('link')->item(0)->nodeValue . "\">";
echo $feeditem->getElementsByTagName('title')->item(0)->nodeValue . "\n";
}
?>






































October 14th, 2008 at 8:24 pm
Demo Doesnt work
October 14th, 2008 at 11:29 pm
Ok fixed now. I replaced the feed with one from another site.
October 24th, 2008 at 9:40 am
Tired of writing lines of lines with source code each time you are coding a website? Feel like just copying and pasting but afraid that you might end up getting sued?
No more worries, WebCodeBase is the website you’ve been looking for!
Here you can find source code that you can copy without any issues at all, we guarantee that you will not get sued for using the code we put on this website. So what are you waiting for?
http://www.webcodebase.com
October 26th, 2008 at 8:52 pm
Sunday In searching for sites related to web hosting and specifically hosting in php script web, your site came up.
November 5th, 2008 at 1:15 am
found your site on del.icio.us today and really liked it.. i bookmarked it and will be back to check it out some more later ..