Revisited: Creating an XML Content Feed With PHP - Testing Our Content Feed (Page 5 of 6 )
Testing our content feed is simple. Firstly, make sure that the feed.php script is in an Apache aware directory on your web server. Next, create a new HTML file named test.html and save it in the same directory as the feed.php script (I will assume that you have saved it in the /php directory of your web servers root directory). Enter the following HTML into test.html:
Run test.html in your web browser. It should look like this:
If you have a registered domain name (such as mysite.com) that points to a web server running PHP and MySQL, then try creating the content database on that server. Upload the feed.php script too. While still keeping the test.html file on your local machine, replace its src attribute to point to the feed.php script on your web server. Run test.html in your browser and it should appear exactly as before.
What makes our content feed dynamic?
Many things. The fact that we have complete control over the feed.php script on our server means that we could change anything we liked in it (maybe to include a sponsors ad) and any sites that were already using our content feed wouldn’t have to do a thing to get the updated version of our content feed because it's retrieved from our server every time it's displayed on their site.
Also, whenever we add a new item to our articles table, it will appear at the top of the content feed. Let's try adding one now. Using the MySQL console application, enter the following query:
insert into articles values(0, 'MySQL Version 4 Released', 'Today, MysQL AB have released MySQL version 4. It comes packed with a number of new features including transactions and faster query execution plans');
Return to your browser and hit the refresh button. It should look like this:
It's just as easy to remove items from our content feed using the MySQL delete command:
delete from articles where articleId < 3;
This would remove those articles whose articeId is less than three, thus leaving two news headlines in our feed: