yaz_scan
(PHP 4 >= 4.0.5, PECL yaz >= 0.9.0)
yaz_scan — Prepares for a scan
Description
$id
, string $type
, string $startterm
[, array $flags
] ) : voidThis 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, yaz_wait() must be called. Upon completion of yaz_wait() call yaz_error() and yaz_scan_result() to handle the response.
Parameters
-
id
-
The connection resource returned by yaz_connect().
-
type
-
Currently only type rpn is supported.
-
startterm
-
Starting 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 yaz_search(). It consists of zero or more @attr-operator specifications, then followed by exactly one token.
-
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 (number of terms requested), position (preferred position of term) and stepSize (preferred step size).
Examples
Example #1 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 ";
}
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 />";
}
}
?>
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-function.yaz-scan.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.