PHP - How to Read RSS

Here's an example of how easy it is to parse RSS feeds using SimpleXML. This particular code reads the RSS of the upcoming Marakana public courses. You can use it on your website.

<?php
                // The List of Public Courses across all Locations
                $feed = simplexml_load_file( "http://marakana.com/training/schedule.rss" );
               
                foreach( $feed->channel->item as $item ) {
                        echo '<a href="', $item->link, '">', $item->title, "</a><br/>\n";
                }
       
        ?>

Go ahead, try it!

Marko

One Response to “PHP - How to Read RSS”

  1. Skooter Says:

    When i copied your code the syntax was all wrong… the commas should be dots and the apostrophes I also had to correct.

Leave a Reply