YAZ Functions YAZ
&reftitle.intro; This extension offers a PHP interface to the YAZ toolkit that implements the Z39.50 Protocol for Information Retrieval. With this extension you can easily implement a Z39.50 origin (client) that searches or scans Z39.50 targets (servers) in parallel. The module hides most of the complexity of Z39.50 so it should be fairly easy to use. It supports persistent stateless connections very similar to those offered by the various RDB APIs that are available for PHP. This means that sessions are stateless but shared among users, thus saving the connect and initialize phase steps in most cases. YAZ is available at &url.yaz;. You can find news information, example scripts, etc. for this extension at &url.yaz-phpyaz;. ¬e.pecl-php5;
&reference.yaz.configure; &reference.yaz.ini;
&reftitle.resources; &no.resource;
&reftitle.constants; &no.constants;
&reftitle.examples; PHP/YAZ keeps track of connections with targets (Z-Associations). A resource represents a connection to a target. The script below demonstrates the parallel searching feature of the API. When invoked with no arguments it prints a query form; else (arguments are supplied) it searches the targets as given in array host. Parallel searching using Yaz GILS test local test Library of Congress
RPN Query: '; } else { echo 'You searched for ' . htmlspecialchars($term) . '
'; for ($i = 0; $i < $num_hosts; $i++) { $id[] = yaz_connect($host[$i]); yaz_range($id[$i], 1, 10); yaz_search($id[$i], "rpn", $term); } yaz_wait(); for ($i = 0; $i < $num_hosts; $i++) { echo '
' . $host[$i] . ':'; $error = yaz_error($id[$i]); if (!empty($error)) { echo "Error: $error"; } else { $hits = yaz_hits($id[$i]); echo "Result Count $hits"; } echo '
'; for ($p = 1; $p <= 10; $p++) { $rec = yaz_record($id[$i], $p, "string"); if (empty($rec)) continue; echo "
$p
"; echo nl2br($rec); echo "
"; } echo '
'; } } ?> ]]>
&reference.yaz.functions;