&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($query) . '
'; for ($i = 0; $i < $num_hosts; $i++) { $id[] = yaz_connect($host[$i]); yaz_syntax($id[$i], "usmarc"); yaz_range($id[$i], 1, 10); yaz_search($id[$i], "rpn", $query); } 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 '
'; } } ?> ]]>