BibleGateway.com
A A A A A
en
Print Printer-friendly page

How to display the Verse of the Day on your Web site

The Verse of the Day is a free service that lets you display an automatically-updating daily Bible verse on your website. This tutorial will show you how to put the Verse of the Day on your website and modify it to display the Bible version and language that you prefer. (The Gospelcom.net main page features a working example of the Verse of the Day if you want to see one way it can be displayed.)

Important technical note: This tutorial requires that your server be running PHP. If you aren't sure if your server is running PHP, please contact your system administrator or look into alternate methods of displaying the Verse of the Day.

This tutorial doesn't assume that you're a technical wizard, but does assume that you know a little bit about HTML and modifying your website code.

Follow the steps outlined below to put the Verse of the Day on your website:

  1. Get a copy of the SOAP library file
  2. Add the Verse of the Day code to your website
  3. Customize the Verse of the Day
  4. Put it online

1) Get a copy of the SOAP library file

The Verse of the Day makes use of the SOAP protocol to display verses. Don't worry--you don't need to know the ins and outs of SOAP to use the Verse of the Day, but you will need to get yourself a copy of the SOAP library file before getting started.

You can download the SOAP library file at this site--it should be called nusoap-x.x.x.zip (the x's stand for version numbers). Once you've downloaded the file, unzip it using Winzip or a similar program.

Put the resulting nusoap.php file on your website. It doesn't matter where you put it, but it might make sense to put it in a new directory called nusoap.

2) Add the Verse of the Day code to your website

Copy the Verse of the Day code below and paste it into the HTML of your website:

<?php
   /**
    * Display Bible Gateway Verse of the Day.
    */

  /* display SOAP errors */
  function showErrors( $soapclient, $results ) {
    echo 'Request: <xmp>'.$soapclient->request.'</xmp>';
    echo 'Response: <xmp>'.$soapclient->response.'</xmp>';
    echo 'Debug log: <pre>'.$soapclient->debug_str.'</pre>';
    echo $results['faultstring'];
  }

  /* load NuSOAP library */
  require_once('./nusoap/nusoap.php');

  /* create new soap client */
  $soapclient = new soapclient('http://www.biblegateway.com/usage/votd/');

  /* set parameter values */
  $parameters= array('preferences'=>array('version_id'=>'31',
         'utc_offset'=>'-5'),
     'options'=>array('include-copyright'=>'both')
    )
  );

  /* call service and get verse of the day */
  $results = $soapclient->call('doGetVotd',$parameters);

  /* display verse of the day */
  if($err = $soapclient->getError()){
    showErrors($soapclient, $results);
  } else {
    print $results;
  }

?>

Important: once you've pasted the Verse of the Day code into your website, you'll need to tell it where to find the nusoap.php file you dealt with in step #1 above. This means you need to change the quoted section of this line of code:

require_once('./nusoap/nusoap.php');


...to accurately point at the nusoap.php file on your website. The path can be relative or absolute.

3) Customize the Verse of the Day

Now you're ready to customize how you want the Verse of the Day to look on your site. Do you want the verse to be from the New International Version, or maybe the New King James Version? You can set these options by adjusting the parameters in the Verse of the Day code. The available parameters and options are all detailed in the full documentation.

You can read about the different options here. Note that for several options, setting a value of "1" enables the option whereas setting a value of 0 disables it.

4) Put it online

Once you're done making your adjustments to the file, you're done! Put your webpage online and check to see if everything is working properly; if everything went as planned, you should now have the Verse of the Day displayed on your site. You can go back to the HTML to make any other adjustments or changes needed to make the Verse display just the way you want it.

Important note: while you are free to customize the Verse of the Day to display the way you'd like, you are required to leave the "Powered by BibleGateway.com" text in place.


The Hope: The Story of God's Promise for All People

Buy a Bible and support BibleGateway.com
Every Bible purchased at GospelDirect.com supports BibleGateway.com

Go to the top of the page
Your donations keep the Bible Gateway going
Contact us/Feedback
Privacy policy
Terms of use

BibleGateway.com is © Copyright 1995-2008 Gospel Communications International

Today's Sponsor:
Gospel Direct
Become a sponsor