Thursday, April 21

DOM to Parse XML and HTML

As you have seen we can easily use DOM to manipulate XML and HTML and it's really very very simple.

You use the $node->getElementsByTagName('title')->item(0)->nodeValue , for instance the <title> tag, you can grab the title.

If you have many nodes, you do a for each loop. Say you have 3 list items in <UL>, you can declare $listitems = $doc->getElementsByTagName('li').
Now we have a group of list items, all we have to do now is loop through them and get our stuff. for each ($listitems as $listitem){ $listitem_output = $listitem->item(0)->nodeValue; echo $listitem_output;}
Isn't that great?

Feel free to checkout some posts on how to get attributes using the getAttribute property from DOM, very exciting stuff this is.

Friday, July 17

RSS PHP: Tutorial #1

In this first RSS PHP Tutorial, we'll look at how PHP uses XML to parse the RSS file.

Here's an example of parsing a RSS file using the function below.

$rss_tags = array(
$rss_item_tag = ‘item’;
$rss_url = ‘’;

$rssfeed = rss_to_array($rss_item_tag,$rss_tags,$rss_url);


function rss_to_array($tag, $array, $url) {
$doc = new DOMdocument();
$rss_array = array();
$items = array();
foreach($doc->getElementsByTagName($tag) AS $node) {
foreach($array AS $key => $value) {
$items[$value] = $node->getElementsByTagName($value)->item(0)->nodeValue;
array_push($rss_array, $items);
return $rss_array;

And there you have your own RSS parser. All we did was put the feed items into an array, now you do the rest!

Make Money with RSS

RSS Parsing: The Future of RSS Aggregation

Thursday, July 16

RSS Parsing: The Jackpot of the Web

RSS PHP Parsers: Your own RSS Aggregator

RSS PHP Parsers basically allows you to use PHP and the power of RSS to create your own Aggregator. Meaning you can now have an automated website or blog with RSS feeding into it, essentially your own RSS Aggregator.

RSS Parsers make it simple to use the RSS feeds as they deal with RSS parsing issues.
Here we have collected the best free RSS to PHP parsers available.

Easy to use RSS PHP parser.
RSS 1.0, 2.0, Atom.

SimplePie is a library of PHP code which parses RSS feeds.

A powerful PHP class for parsing RSS feeds.
All RSS versions supported.

Another easy to use RSS parser.

Template by James William at 2600 Degrees