<HTML ><HEAD ><TITLE >YAZ functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Function Reference" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="xslt_set_scheme_handlers" HREF="function.xslt-set-scheme-handlers.html"><LINK REL="NEXT" TITLE="yaz_addinfo" HREF="function.yaz-addinfo.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.xslt-set-scheme-handlers.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.yaz-addinfo.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.yaz" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >CX. YAZ functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN97442" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="yaz.intro" ></A >Introduction</H1 ><P > This extension offers a PHP interface to the <SPAN CLASS="productname" >YAZ</SPAN > toolkit that implements the <A HREF="http://www.loc.gov/z3950/agency/" TARGET="_top" >Z39.50 Protocol for Information Retrieval</A >. With this extension you can easily implement a Z39.50 origin (client) that searches or scans Z39.50 targets (servers) in parallel. </P ><P > 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 amongst users, thus saving the connect and initialize phase steps in most cases. </P ><P > <SPAN CLASS="productname" >YAZ</SPAN > is available at <A HREF="http://www.indexdata.dk/yaz/" TARGET="_top" >http://www.indexdata.dk/yaz/</A >. You can find news information, example scripts, etc. for this extension at <A HREF="http://www.indexdata.dk/phpyaz/" TARGET="_top" >http://www.indexdata.dk/phpyaz/</A >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="yaz.installation" ></A >Installation</H1 ><P > Compile YAZ (ANSI/NISO Z39.50 support) and install it. Build PHP with your favourite modules and add option <TT CLASS="option" >--with-yaz[=DIR]</TT >. Your task is roughly the following: </P ><P > <DIV CLASS="informalexample" ><A NAME="AEN97458" ></A ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="shell" >gunzip -c php-4.3.X.tar.gz|tar xf - gunzip -c yaz-1.9.Y.tar.gz|tar xf - cd yaz-1.9.Y ./configure --prefix=/usr make make install cd ../php-4.3.X. ./configure --with-yaz=/usr/bin make make install</PRE ></TD ></TR ></TABLE ><P ></P ></DIV > </P ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Warning</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P >The <A HREF="ref.imap.html" >IMAP</A > extension cannot be used in conjuction with the <A HREF="ref.recode.html" >recode</A > or <A HREF="ref.yaz.html" >YAZ</A > extensions. This is due to the fact that they both share the same internal symbol.</P ></TD ></TR ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="yaz.configuration" ></A >Runtime Configuration</H1 ><P > The behaviour of these functions is affected by settings in <TT CLASS="filename" >php.ini</TT >. </P ><P > <DIV CLASS="table" ><A NAME="AEN97470" ></A ><P ><B >Table 1. YAZ configuration options</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><THEAD ><TR ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Name</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Default</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Changeable</TH ></TR ></THEAD ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >yaz.max_links</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >"100"</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_ALL</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >yaz.log_file</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >""</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_ALL</TD ></TR ></TBODY ></TABLE ></DIV > For further details and definition of the PHP_INI_* constants see <A HREF="function.ini-set.html" ><B CLASS="function" >ini_set()</B ></A >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="yaz.resources" ></A >Resource Types</H1 ><P >This extension has no resource types defined.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="yaz.constants" ></A >Predefined Constants</H1 ><P >This extension has no constants defined.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="yaz.examples" ></A >Examples</H1 ><P > PHP/YAZ keeps track of connections with targets (Z-Associations). A resource represents a connection to a target. </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN97498" ></A ><P ><B >Example 1. <B CLASS="function" >Parallel searching using YAZ()</B ></B ></P ><P > 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 <TT CLASS="literal" >host</TT >. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >$num_hosts = count ($host); if (empty($term) || count($host) == 0) { echo '<form method="get"> <input type="checkbox" name="host[]" value="bagel.indexdata.dk/gils"> GILS test <input type="checkbox" name="host[]" value="localhost:9999/Default"> local test <input type="checkbox" checked="1" name="host[]" value="z3950.loc.gov:7090/voyager"> Library of Congress <br> RPN Query: <input type="text" size="30" name="term"> <input type="submit" name="action" value="Search"> '; } else { echo 'You searced for ' . htmlspecialchars($term) . '<br>'; 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 '<hr>' . $host[$i] . ":"; $error = yaz_error($id[$i]); if (!empty($error)) { echo "Error: $error"; } else { $hits = yaz_hits($id[$i]); echo "Result Count $hits"; } echo '<dl>'; for ($p = 1; $p <= 10; $p++) { $rec = yaz_record($id[$i],$p,"string"); if (empty($rec)) continue; echo "<dt><b>$p</b></dt><dd>"; echo ereg_replace("\n", "<br>\n",$rec); echo "</dd>"; } echo '</dl>'; } }</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT ><A HREF="function.yaz-addinfo.html" >yaz_addinfo</A > -- Returns additional error information</DT ><DT ><A HREF="function.yaz-ccl-conf.html" >yaz_ccl_conf</A > -- Configure CCL parser</DT ><DT ><A HREF="function.yaz-ccl-parse.html" >yaz_ccl_parse</A > -- Invoke CCL Parser</DT ><DT ><A HREF="function.yaz-close.html" >yaz_close</A > -- Close YAZ connection</DT ><DT ><A HREF="function.yaz-connect.html" >yaz_connect</A > -- Prepares for a connection to a Z39.50 target (server). </DT ><DT ><A HREF="function.yaz-database.html" >yaz_database</A > -- Specifies the databases within a session </DT ><DT ><A HREF="function.yaz-element.html" >yaz_element</A > -- Specifies Element-Set Name for retrieval </DT ><DT ><A HREF="function.yaz-errno.html" >yaz_errno</A > -- Returns error number</DT ><DT ><A HREF="function.yaz-error.html" >yaz_error</A > -- Returns error description</DT ><DT ><A HREF="function.yaz-get-option.html" >yaz_get_option</A > -- Returns value of option for connection</DT ><DT ><A HREF="function.yaz-hits.html" >yaz_hits</A > -- Returns number of hits for last search</DT ><DT ><A HREF="function.yaz-itemorder.html" >yaz_itemorder</A > -- Prepares for Z39.50 Item Order with an ILL-Request package </DT ><DT ><A HREF="function.yaz-present.html" >yaz_present</A > -- Prepares for retrieval (Z39.50 present). </DT ><DT ><A HREF="function.yaz-range.html" >yaz_range</A > -- Specifies the maximum number of records to retrieve </DT ><DT ><A HREF="function.yaz-record.html" >yaz_record</A > -- Returns a record</DT ><DT ><A HREF="function.yaz-scan-result.html" >yaz_scan_result</A > -- Returns Scan Response result</DT ><DT ><A HREF="function.yaz-scan.html" >yaz_scan</A > -- Prepares for a scan</DT ><DT ><A HREF="function.yaz-schema.html" >yaz_schema</A > -- Specifies schema for retrieval. </DT ><DT ><A HREF="function.yaz-search.html" >yaz_search</A > -- Prepares for a search</DT ><DT ><A HREF="function.yaz-set-option.html" >yaz_set_option</A > -- Sets one or more options for connection</DT ><DT ><A HREF="function.yaz-sort.html" >yaz_sort</A > -- Sets sorting criteria</DT ><DT ><A HREF="function.yaz-syntax.html" >yaz_syntax</A > -- Specifies the preferred record syntax for retrieval. </DT ><DT ><A HREF="function.yaz-wait.html" >yaz_wait</A > -- Wait for Z39.50 requests to complete</DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.xslt-set-scheme-handlers.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.yaz-addinfo.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >xslt_set_scheme_handlers</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >yaz_addinfo</TD ></TR ></TABLE ></DIV ></BODY ></HTML >