(PHP 4 >= 4.0.5)

yaz_scan -- Prepares for a scan


int yaz_scan ( resource id, string type, string startterm [, array flags])

This function prepares for a Z39.50 Scan Request, where parameter id specifies connection. Starting term point for the scan is given by startterm. The form in which the starting term is specified is given by parameter type. Currently only type rpn is supported. The optional parameter flags specifies additional information to control the behaviour of the scan request. Three indexes are currently read from the flags: number (number of terms requested), position (preferred position of term) and stepSize (preferred step size). To actually transfer the Scan Request to the server and receive the Scan Response, yaz_wait() must be called. Upon completion of yaz_wait() call yaz_error() and yaz_scan_result() to handle the response.

The syntax of startterm is similar to the RPN query as described in yaz_search(). The startterm consists of zero or more @attr-operator specifications, then followed by exactly one token.

例子 1. PHP function that scans titles

function scan_titles($id, $startterm)
yaz_scan($id, "rpn", "@attr 1=4 " . $startterm);
$errno = yaz_errno($id);
  if (
$errno == 0) {
$ar = yaz_scan_result($id, &$options);
'Scan ok; ';
    while (list(
$key, $val) = each($options)) {
"$key = $val &nbsp;";
'<br /><table>';
    while (list(
$key, list($k, $term, $tcount)) = each($ar)) {
      if (empty(
$k)) continue;
  } else {
"Scan failed. Error: " . yaz_error($id) . "<br />";

虎的笑话 虎的成语 虎的歇后语