Heal Your Church WebSite


Teaching, rebuking, correcting & training in righteous web design.

ESV Bible RSS Feed using PHP

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.



BTW, since everyone loves a happy ending, I figured I’d let you know that I did finally hear from the good folks at Good News Publishers. A very nice note that’s going to lead into some very cool code in the not too distant future. Part of the communications issue was a DDoS attack on my side, and Glenn Slaven being 12 hours ahead of me. Now if Glenn would only tell me if the Oriole’s are going to win tonight, I’d be set.

Stay tuned. Leave comments. Let me know if the above works for you. Share improvements. Enjoy the day. I know I wil!-)

4 Comments

  1. The ESV has fast become my translation of choice since finding it shortly before its launch. Yes, before. Selections were available on the web. And, now I even own a NT on Audio CD and that is just the best way to come and go from work.

    thrive
    O

  2. Inquiry. In the crontab code in the script it references /home/YOURPATH/FeedMaggie.php What is feedmaggie.php?

    Thanks and sorry for the silly question. I am a newbie.

    Thanks,

  3. Sorry. Think I almost have it. Think what threw me off was the “esvdaily.php” above the code then in the code the feedmaggie.php reference.

    Anyway almost there. Thanks for the script.

  4. Hi.

    I am brand new at this. I came across a site that has a daily devotional, and I want to do the same thing. How can I make it work on my site?
    The site I saw was http://www.ilovemychurch.org/OneYearBible.html

    Can you help me figure this out?

    Thanks!