yaz_scan
yaz_scan
Prepares for a scan
void **yaz_scan** resource $id string $type string $startterm array $flags
This function prepares for a Z39.50 Scan Request on the specified connection.
To actually transfer the Scan Request to the server and receive the
Scan Response, must be called. Upon
completion of call
and to
handle the response.
yaz_wait``yaz_wait``yaz_error``yaz_scan_result
id
The connection resource returned by .
yaz_connect
type
Currently only type is supported.
rpn
starttermStarting term point for the scan.
The form in which the starting term is specified is given by parameter
.
`type`
The syntax this parameter is similar to the RPN query as described in
. It consists of zero or more
-operator specifications, then followed by
exactly one token.
`yaz_search``@attr`
flags
This optional parameter specifies additional information to control
the behaviour of the scan request. Three indexes are currently read
from the flags array:
(number of terms requested),
(preferred position of term) and
(preferred step size).
number``position``stepSize
return.void
Voorbeeld: PHP function that scans titles
<?php
function scan_titles($id, $startterm)
{
yaz_scan($id, "rpn", "@attr 1=4 " . $startterm);
yaz_wait();
$errno = yaz_errno($id);
if ($errno == 0) {
$ar = yaz_scan_result($id, $options);
echo 'Scan ok; ';
foreach ($options as $key => $val) {
echo "$key = $val nbsp";
}
echo '<br /><table>';
while (list($key, list($k, $term, $tcount)) = each($ar)) {
if (empty($k)) continue;
echo "<tr><td>$term</td><td>$tcount</td></tr>";
}
echo '</table>';
} else {
echo "Scan failed. Error: " . yaz_error($id) . "<br />";
}
}
?>