Welcome to Egypt Forums Mark forums read | Egypt Main Page
Egypt Forums
Arabic Movies



PHP PHP Tutorial , PHP Basic , PHP Advanced , PHP Database , PHP XML , beginner's guide,primer,training,learning,internet,database,development,Web building,Webmasterhowto,reference,examples,samples.

PHP Thread, PHP RSS Parsing Tutorial in Web Development; PHP RSS Parsing Tutorial I made a tutorial a while back which parsed RSS feeds however it was really simple, ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=6713


Reply
LinkBack Thread Tools Display Modes
PHP RSS Parsing Tutorial
 
 
The God Father
Developer's Avatar

Reply With Quote
 
Join Date: Jul 2008
Location: NDC
Posts: 5,425
26-11-2008, 10:20 PM
 
PHP RSS Parsing Tutorial

Egypt.Com EnForum
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….
PHP Code:
<?php
load
('RSS Feed Address');
foreach (
$xmldoc->getElementsByTagName('item') as $feeditem) {
echo
"getElementsByTagName('link')->item(0)->nodeValue . "">";
echo
$feeditem->getElementsByTagName('title')->item(0)->nodeValue . "\n";
}
?>
See You !
__________________
I Love Walking In The Rain Cuz Nobody Know I'm Crying !!
 
 
 
Reply

PHP Thread, PHP RSS Parsing Tutorial in Web Development; PHP RSS Parsing Tutorial I made a tutorial a while back which parsed RSS feeds however it was really simple, ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=6713


Bookmarks

Tags
parsing, php, rss, tutorial


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: How to run vBulletin onto your PC Developer Articles 24 30-05-2009 09:05 AM
Oracle PL/SQL Tutorial Developer Articles 0 04-12-2008 02:09 AM
Photoshop space tutorial Developer Articles 0 04-11-2008 04:01 AM
Web 2.0 Button Tutorial - Video Developer Web Application 0 13-09-2008 11:06 PM
C++ Language Tutorial Developer Classes & Source Code 0 04-09-2008 10:07 PM