<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <title>Пример подключения PHP Скрипта к Web Services на bible.uucyc.info</title>
    <meta http-equiv="content-type" content="text/html; charset=windows-1251">
    <meta name="Author" content="Arthur Harder">
    <style type="text/css">
<!--
body {
    font:12px Verdana, Geneva, Arial, Helvetica, sans-serif;
}

.normal {
    background-color:#FFFDF1;
    border-top:1px solid #ADADAD;
    border-right:1px solid #ADADAD;
    border-bottom:1px solid #ADADAD;
    border-left:1px solid #ADADAD;
}

.buttons {
    background-color:#D4D0C8;
    border-top:1px solid #ADADAD;
    border-right:1px solid #ADADAD;
    border-bottom:1px solid #ADADAD;
    border-left:1px solid #ADADAD;
}

.buttonshighlight {
    background-color:#FFFDF1;
    border-top:1px solid #ADADAD;
    border-right:1px solid #ADADAD;
    border-bottom:1px solid #ADADAD;
    border-left:1px solid #ADADAD;
}

.buttonclick {
    background-color:#FFFDF1;
    color:#FF7F50;
    border-top:1px dashed #ADADAD;
    border-right:1px dashed #ADADAD;
    border-bottom:1px dashed #ADADAD;
    border-left:1px dashed #ADADAD;
}
-->
    </style>
  </head>
  <body>
<?php
global $searchstring$searcharea;
require(
'webservices/nusoap.php');
$soapclient = new soapclient('http://bible.uucyc.info/biblequote.php');

$parameters = array('login'=>'Login','pwd'=>'Password');
$res $soapclient->call('getQuote',$parameters);

if(
$err $soapclient->getError())
{
    echo 
$err;
}
else
{
    echo <<<END
    <table width="300" align="center" style="background-color:#F5F5FF; border-width:2px 2px 2px 2px; border:solid #CCCCFF;" cellspacing="6" cellpadding="0">
      <tr>
        <td style="background-color:#f5f5ff">
          <div style="text-align:center"><b>$res
[title]</b></div><br />
          <div style="text-align:justify">$res
[ot_content]</div>
          <div style="text-align:right">$res
[ot_quote]</div><br />
          <div style="text-align:justify">$res
[nt_content]</div>
          <div style="text-align:right">$res
[nt_quote]</div>
        </td>
      </tr>
    </table>

END;
}

$codedsearchable urlencode(htmlspecialchars($searchstring));
$parameters = array('searchstring'=>"$codedsearchable",'searcharea'=>"$searcharea",'login'=>'Login','pwd'=>'Password');
$res $soapclient->call('searchVersPlain',$parameters);

$searchable htmlspecialchars($searchstring);

switch (
$searcharea)
{
    case 
'oldtastament':
        
$sel1 '';
        
$sel2 ' selected';
        
$sel3 '';
        
$sel4 '';
    break;

    case 
'apokr':
        
$sel1 '';
        
$sel2 '';
        
$sel3 ' selected';
        
$sel4 '';
    break;

    case 
'all':
        
$sel1 '';
        
$sel2 '';
        
$sel3 '';
        
$sel4 ' selected';
    break;

    default:
        
$sel1 ' selected';
        
$sel2 '';
        
$sel3 '';
        
$sel4 '';
    break;
}

echo <<<END
    <form method="post" action="$PHP_SELF" style="margin:0px;" name="searchform">
      <table width="100%" cellspacing="8" cellpadding="0" border="0">
         <tr>
          <td>Искать в Библии:&nbsp;<input type="text" name="searchstring" value="$searchable" style="width:250px;" class="normal"> &nbsp;&nbsp;&nbsp;Область поиска:&nbsp;<select name="searcharea" class="normal" style="width:140px;">
              <option value="newtastament"$sel1>Новый Завет</option>
              <option value="oldtastament"$sel2>Ветхий Завет</option>
              <option value="apokr"$sel3>Апокрифы</option>
              <option value="all"$sel4>Вся Библия</option>
            </select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="Искать" class="buttons" onmouseover="this.className='buttonshighlight'; this.style.cursor='pointer';" onmouseout="this.className='buttons';" onMousedown="this.className='buttonclick';">
          </td>
        </tr>
      </table>
    </form>
    <br />

END;

if (!empty(
$res['message']))
{
    echo 
$res['message'] . "<br />";
}
else
{
    if (
$res['found']) echo<<<END
    <table width="100%" cellspacing="6" cellpadding="0" border="0">
      <tr>
        <th colspan="2">Поиск "$searchable" дал $res
[found] результатов.</th>
      </tr>

END;

    if (!
is_array($res)) $res = array();
    foreach (
$res as $key=>$val)
    {
        if (
$key != 'found' && $key != 'message')
        {
            
$erg explode('@',$val);
            echo 
"      <tr>\n        <td style=\"vertical-align:top; text-align:left\" nowrap=\"nowrap\">\n" $erg[0] . "\n        </td>\n          <td style=\"vertical-align:top; text-align:left\">\n" $erg[1] . "\n        </td>\n          </tr>\n";
        }
    }
    echo 
"    </table>\n";
}

?>

</body>
</html>