As promised, the ESV Bible RSS Feed, now peachy PHP flavor! To get this done, I dipped back into two past articles. One entitled Using PHP from the command line. This is necessary as we want to add our application to the CRONTAB. For those of you new to this site, and for those of you who are not fluent in classical geek, CRON is the scheduling process associated with various flavors of *NIX, such as Linux. The CRONTAB is the table where jobs are enumerated and defined. Here is a past article of mine which points to some effective CRON tutorials you might find useful.
The other tool we need is an effective way of slicing-n-dicing RSS files. As I stated in yesterday’s article, RSS is an XML file designed to talk to computer programs via the HTTP protocol. This means once we obtain the ESV RSS feed, we need to extract the data so we can render it in a human-friendly format. To do this, I’m going to again dip back into a past article and employ a wonderful little PHP library known as MagpieRSS.
In about ten minutes, I had a working code that read the ESV Bible RSS Feed, extracted the good stuff, and then created an include file I could … well include in my web pages using pretty much the same techniques I stated in my article Similar in concept to “Using Cron with LWP::Simple and XML::RSS to retrieve news feeds.” You’ll also note that this program bails without creating content if it finds no data elements. And if it does, it takes care of some of the “whitespace” issues I mentioned in yesterday’s post.
Yeah, I know, alot of repeating myself going on. It comes from fathering a strong-willed 3.5 year old. I’ll stop that now and give you what you really came here for, the code. Feel free to use it and improve it. But if you do the later, then please, com’n back and share a comment so the rest of us can benefit from it.