Have you ever wondered how some websites display combined data from various websites? This is a bit of trickery that can be done using a few methods, including having select database privileges from the sources, scraping data and using RSS feeds – or, in fact, any combination of these three methods.
In this tutorial we’ll focus on how to retrieve and combine data from other sources using RSS feeds. RSS, which stands for Rich Site Summary (and later Really Simple Syndication), has been around a long time – and stems from Ramanathan V. Guha’s work at the Apple Computer’s Advanced Technology Group in the mid-1990s – and you probably use them every day to display news feeds among other useful data.
RSS is generally XML files that contain data within organised tags, eg if you go to Craigslist and browse through regular listings you will see the usual list of items. This source code is HTML. But, if you look at the Craigslist RSS feed file for those same items you won’t see HTML code in your browser you’ll see an XML file that stores each listing within a parent ‘item’ tag.
Each item tag contains information for an entry such as title, date and description. Grabbing and aggregating RSS feeds with a simple PHP script is a fast and simple way to tap into your desired data and output the results you want. These RSS feeds are provided from many large classified and auction websites (such as eBay, eBay Classifieds, Monster and Craigslist etc) and many other websites, such as job websites (eg CareerBuilder and Indeed allow you to obtain XML feeds that can be parsed too).
In many instances, you can just use a specific URL to acquire RSS feeds, while at other times you’ll need to use an API with a specified publisher key in order to obtain the feeds. One example of websites that require the publisher key for the API is the popular job site, Indeed.com. Since we had to pick an example topic, we’ll explain how to aggregate RSS from the various sources we’ve mentioned above.
Our examples will show you how to narrow down a job search to location and job position or you could just as easy make this a personal RSS and XML feed aggregator to display bargains of items you want to buy from eBay, Craigslist etc. In addition to the above, the output will load in your browser on a local web server, such as a LAMP setup running on the Ubuntu distribution (distro). Installing LAMP only takes a minute or two but we’ll explain how to do that as well. When your output is shown in the web browser, it will link back to the original post and you can do what you want from there, eg inquire about the job position etc.