PHP 5 comes with a great built-in library for working with XML. SimpleXML allows you to easily read XML files and parse them into logical bits of data. No more writing XML parsers - the work has been done for you.
So what can you do with PHP and XML together? And how can you do it?
Write Your Own Feed
Many blogs and CMS platforms automatically create RSS feeds. If you're not using one of these, though, you should look into making your own RSS feed. It's a great way to get your content to the user quickly and consistently - so he or she never forgets to come back.
Creating a feed is an amazingly simple process. You need to scrape together a little information - a list of articles with titles, links, and descriptions. Then you need to format it into special XML tags. Finally, you write a file - and you're done.
If you're unfamiliar with the format of an RSS feed, try taking a look at the RSS 2.0 specification. Then look at some sample feeds. Finally, if you're having trouble, have a read through this tutorial on creating your own custom feed.
Parse Someone Else's Feed
There are tons of social bookmarking sites out there - like Digg, dZone, Furl, and others. I'm sure you've got your favorite.
Chances are that your favorite social bookmarking site publishes a feed of new links broken down by topics. Wouldn't it be cool if you could publish those links - updated in real time - on your site?
Well, you can. All you need to do is use SimpleXML to read the feed, break it down into a few common parts, and then create links based on that information. Every feed has at least some basic information on the articles it contains - including a title and a URL. That's all you need to build a list of "Recent Links from My Social Bookmarking Site."
If you want to see an example, check out this tutorial on syndicating an RSS feed. You can see a live feed from dZone.com on the right hand side of the screen.
Get Cool Information from Your Favorite Sites
XML is used to distribute all kinds of information - not use the latest new links.
Digg recently created an API for developers to access all kinds of Digg-related information. You can get archived articles, comments, user profiles, category lists, and much more. For some guidance on this front, check out this tutorial on getting a random article from Digg.
World of Warcraft also makes use of XML to display some of its vital information - character sheets. If you go to the Armory, you'll see your entire character summed up in XML. You can read this information and use it to display your characters stats all over the internet.
Think Big, and Start Developing
SimpleXML makes it a breeze to work with XML files in PHP. There's no reason not to utilize this great resource and use XML feeds and sources across the internet to enhance your site. It can bring content in and it can send content out, but it won't do anything until you start working on it.
Published by B. Rock
I'm a recent graduate, a newly wed, and a (no longer first year) teacher. I teach HS Social Studies in a New Jersey city. I graduated from the Rutgers Grad School of Ed in May of 2007. In July '07, I... View profile
An Introduction to Website DesignBlogging, parked domains, writing for payment-do these sound familiar? Nothing is easy, but with greater difficulty comes greater reward. Hence, website design.- Thesis: "Computer Systems Emulator"Thesis: "Computer Systems Emulator"
Promoting AC Content Using Social Bookmarking Sites: Furl.net And MoreThe purpose of this article is to help AC's Content Producers understand social bookmarking sites and how they can be used to promote content and generate page views.
Social Bookmarking and Article Promotion with OnlywireOnlywire is a social bookmarking tool that takes a lot of the hassle out of all that clicking and explaining. Imagine being able to send your articles to 19 other sites, just l...- Social Bookmarking: What is It? How Do You Use It? An explanation of how to use social bookmarking, what social bookmarking is and some of the problems that can occur when people use social bookmarking.
- An Introduction to XML and Interactive Web Technologies
- What is an RSS Feed?
- How to Create Your Own Podcast: RSS Feed Files and Podcast Hosts
- Introduction to PHP 5 and SimpleXML
- Drive Image XML - Free Computer Tool
- You Need XML Codes to Promote Your Website
- XML Sitemap: An Integral Part of Your SEO Plan
- Using XML and PHP, you can build a custom RSS feed for your site.
- Social Bookmarking sites publish feeds of new links that you can easily syndicate on your site.
- Tons of information is available through XML - like Digg stats and WoW character data.
