getError();
if ($error) {
echo "
Constructor error
" . $error . "
";
}
$result = $client->call("getQuote", array("book" => $book));
trace("\t\$result returned.");
if ($client->fault) {
echo "Fault
";
print_r($result);
echo "
";
}
else {
$error = $client->getError();
if ($error) {
echo "Error
" . $error . "
";
}
else {
transform($result);
}
}
function transform($xml) {
// Build XSL
$xsl = '
Quote of the Day
A Bible Quote for Today
:
';
$xslDoc = DOMDocument::loadXML($xsl);
$xmlDoc = DOMDocument::loadXML($xml);
$processor = new XSLTProcessor();
$processor->importStyleSheet($xslDoc);
echo $processor->transformToXML($xmlDoc);
}
function trace($message) {
$outFile = "bibleWStrace.log"; // write new data to file
$fh = fopen($outFile, 'a') or die("can't open file"); // 'w' = overwrite existing file, 'a' = add to file
$now = date('Y-m-d H:i:s');
$file = pathinfo(__FILE__); // Get information about this file.
fwrite($fh,"\n" . $now .": " . $message . " (" . $file['dirname'] . "/" . $file['basename'] . ")");
}