I've been trying my hand at yaz via php.
I should say that I know nothing of yaz, and little of php.
Perhaps because of this, I have had no success.
Here is a sample php program.
Could some kind soul please tell me why I seem to get no
success?
I should say that I am testing this on a machine running
Fedora 6 Linux.
-------------------------------------------------------
<html>
<body>
<?php
$query=" attr 1=7 0521458862";
$host="z3950.loc.gov:7090/voyager";
echo "Trying to connect to $host ... ";
$id = yaz_connect($host);
echo "Connected; ";
yaz_syntax($id, "usmarc");
yaz_range($id, 1, 10);
yaz_search($id, "rpn", $query);
yaz_wait();
echo '<hr />' . $host . ':';
$error = yaz_error($id);
if (!empty($error)) {
echo "Error: $error";
} else {
$hits = yaz_hits($id);
echo "Result Count $hits";
}
echo '<dl>';
for ($p = 1; $p <= 10; $p++) {
$rec = yaz_record($id, $p, "string");
if (empty($rec)) continue;
echo
"<dt><b>$p</b></dt><dd>&q
uot;;
echo nl2br($rec);
echo "</dd>";
}
echo '</dl>';
?>
</body>
</html>
-------------------------------------------------------
A couple of comments.
Fedora 6 did not seem to have the yaz-php module
(as shown by the fact that it reported that
the function yaz_connect() was unknown).
So I downloaded the source as yaz-1.0.8.tgz,
expanded it and ran "pecl build package.xml".
I don't really know if that is what one is meant to do,
but it seemed to work, in so far as there was no longer
a complaint that yaz_connect() was unknown.
Now when I browse to foo.php (the above file) on my
web-server
the program does not seem to get past the yaz_connect()
line.
If anyone has a simple program like this which works for
them,
I'd very much like to see it;
I didn't find any small examples of yaz-php usage
on a brief google search.
--
Timothy Murphy
e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2,
Ireland
_______________________________________________
Yazlist mailing list
Yazlist lists.indexdata.dk
http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yaz
list
|