PDA

View Full Version : nusoap help



thebeard
06-26-2007, 11:52 AM
I ws hoping to place a "verse of the day" php script from biblegateway.com on a site. The directions require loading the nusoap php files on the root of the site, which I did but when I publish the page I get the following:

request''; echo 'Response: '$soapclient->response''; echo 'Debug log:
'$soapclient->debug_str'
'; 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; } ?>

What's missing?
the page I'm working on is here (http://www.thirdreformed.net)

areidmtm
06-26-2007, 01:03 PM
It doesn't look like that you have the <?php at the beginning of your php code

thebeard
06-26-2007, 01:12 PM
Sorry, the code I pasted above is actually the erro message I get rather than the elements I want. here's the code from the doc:

<?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;
}

?>

I have tried taking the "." out before the "/" and nothing changed

areidmtm
06-26-2007, 01:15 PM
the reason why i said that is because when you go to the site, it's not parsing the php, it's showing the php code. That led me to believe that the <?php wasn't there at the beginning of that code.

Pethens
06-26-2007, 02:00 PM
I notice that your page is available at http://www.thirdreformed.net/index.html
but if you go to http://www.thirdreformed.net/index.php, you get a file not found error.

Try renaming your file to index.php so that the php code it contains will be interpreted, or add some code to your .htaccess to parse html files as php.

thebeard
06-26-2007, 03:56 PM
Try renaming your file to index.php so that the php code it contains will be interpreted, or add some code to your .htaccess to parse html files as php.

That did it. Would this not cause a problem with each html page the code was put in? Or is it just becuase mine is the index? Should I warn the creator of the code/tutorial? This point was not addressed at all.

Thanks for the help.

Pethens
06-26-2007, 05:31 PM
For most people, it's not going to work if they paste the code into an html file. If that's what the instructions say to do, I vote for changing them. In any case, you could let the author know that the instructions were confusing to at least one person.

MeanDean
07-11-2007, 12:21 PM
Part of the problem with the BibleGateway sample code displayed above - it has a bug.

It's display is also not-so-useful to programmers.

I've written in detail how to remedy the bug and how to display the information using the above sample in an article on my blog entitled:
Cleaning-up the BibleGateway SOAP example (http://healyourchurchwebsite.com/2007/07/11/cleaning-up-the-biblegateway-soap-example/)

Hope it helps.