Displaying RSS feeds with jQuery and PHP
In this recipe we will fetch a Really Simple Syndication (RSS) feed of a blog using PHP and then display it in the page using jQuery. RSS is a standard format for publishing feeds and there are several formats of RSS feeds. The feed we will use is in RSS2.0 and its standard structure is shown in the following screenshot:
Getting ready
Create a folder named Recipe5
inside the Chapter9
directory.
How to do it...
Create a file
index.html
insideRecipe5
folder. In this file, define some CSS styles for elements and create adiv
with IDresults
, which will serve as a container for displaying posts from the feed.<html> <head> <title>Parse RSS Feed</title> <style type="text/css"> body { font-family:"Trebuchet MS",verdana,arial;width:900px;margin:0 auto; } ul{ border:1px solid #000;float:left;list-style:none;margin:0;padding:0;width:900px; } li{ padding:5px;border:1px solid #000; } h3 { color:brown...