Getting Alternate ISBNs
I’ve added the following function to the version of the XMLOPAC class I use internally so that I can get alternate ISBNs using OCLC’s xISBN service.
public function get_altisbn($isbn) {
$xmlopacurl = 'http://labs.oclc.org/xisbn/' . $isbn;
$xml = self::prep_xml($xmlopacurl);
$result = array();
foreach ($xml->xpath('/idlist/isbn') as $temp) {
$result[] = (string) $temp;
}
// the first element of the array is always the same as
// the query ISBN, array_shift deletes it from the array
array_shift($result);
return($result);
}
I then call it from within the get_opac_data() function like this:
$result[altisbn] = self::get_altisbn($result[isbn]);
The result, of course, is an array of ISBNs that serves all sorts of meaningful purposes, like finding an ASIN when you don’t find a match for the cataloged ISBN.
Technorati Tags: isbn, library, libraries, oclc, php, web service, xml, xmlopac, xmlopac class

Leave a Reply
Comments should show a courteous regard for the presence of other voices in the discussion. We reserve the right to edit or delete comments that do not adhere to this standard.