10 use HTTP
::Request
::Common
;
13 binmode(STDOUT
, "utf8"); #output as utf8
14 my $baseurl = C4
::Context
->preference('OPACBaseURL');
15 warn "Warning: OPACBaseURL not set in system preferences" unless $baseurl;
17 my $id = $cgi->param('id');
18 my $format = $cgi->param('format');
21 # koha:isbn:0152018484
23 $id =~ s/koha:isbn://;
25 # two ways to do this, one via the SRU Zebra server (fast)
26 my $url = "http://$baseurl:9998/biblios?version=1.1&operation=searchRetrieve&query=$id&startRecord=1&maximumRecords=20&recordSchema=$format";
27 my $content= get
($url);
29 # the other via XSL parsing (not as fast)
33 my $conn = C4
::Context
->Zconn('biblioserver');
34 $conn->option(preferredRecordSyntax
=> $format);
35 my $rs = $conn->search_pqf('@attr 1=7 '.$id);
37 $content = $rs->record(0)->raw();
40 print "Error ", $@
->code(), ": ", $@
->message(), "\n";
44 print $cgi->header( -type
=>'application/xml' );
51 print $cgi->header( -type
=>'application/xml' );
53 print "<?xml version='1.0' encoding='utf-8' ?>
55 <!-- <format name=\"opac\" type=\"text/html\"/> -->
56 <!-- <format name=\"html\" type=\"text/html\"/> -->
57 <!-- <format name=\"htmlholdings\" type=\"text/html\"/> -->
58 <!-- <format name=\"html-full\" type=\"text/html\"/> -->
59 <!-- <format name=\"htmlholdings-full\" type=\"text/html\"/> -->
60 <!-- <format name=\"atom\" type=\"application/xml\" namespace_uri=\"http://www.w3.org/2005/Atom\" docs=\"http://www.ietf.org/rfc/rfc4287.txt\"/> -->
61 <!-- <format name=\"atom-full\" type=\"application/xml\" namespace_uri=\"http://www.w3.org/2005/Atom\" docs=\"http://www.ietf.org/rfc/rfc4287.txt\"/> -->
62 <format name=\"marcxml\" type=\"application/xml\" namespace_uri=\"http://www.loc.gov/MARC21/slim\" docs=\"http://www.loc.gov/marcxml/\" schema_location=\"http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd\"/>
63 <format name=\"marcxml-full\" type=\"application/xml\" namespace_uri=\"http://www.loc.gov/MARC21/slim\" docs=\"http://www.loc.gov/marcxml/\" schema_location=\"http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd\"/>
64 <format name=\"mods\" type=\"application/xml\" namespace_uri=\"http://www.loc.gov/mods/\" docs=\"http://www.loc.gov/mods/\" schema_location=\"http://www.loc.gov/standards/mods/mods.xsd\"/>
65 <format name=\"mods-full\" type=\"application/xml\" namespace_uri=\"http://www.loc.gov/mods/\" docs=\"http://www.loc.gov/mods/\" schema_location=\"http://www.loc.gov/standards/mods/mods.xsd\"/>
66 <format name=\"mods3\" type=\"application/xml\" namespace_uri=\"http://www.loc.gov/mods/v3\" docs=\"http://www.loc.gov/mods/\" schema_location=\"http://www.loc.gov/standards/mods/v3/mods-3-1.xsd\"/>
67 <format name=\"mods3-full\" type=\"application/xml\" namespace_uri=\"http://www.loc.gov/mods/v3\" docs=\"http://www.loc.gov/mods/\" schema_location=\"http://www.loc.gov/standards/mods/v3/mods-3-1.xsd\"/>
68 <format name=\"oai_dc\" type=\"application/xml\" namespace_uri=\"http://www.openarchives.org/OAI/2.0/oai_dc/\" schema_location=\"http://www.openarchives.org/OAI/2.0/oai_dc.xsd\"/>
69 <format name=\"rdfdc\" type=\"application/xml\" namespace_uri=\"http://purl.org/dc/elements/1.1/\" schema_location=\"http://purl.org/dc/elements/1.1/\"/>
70 <format name=\"rss2\" type=\"application/xml\"/>
71 <format name=\"rss2-full\" type=\"application/xml\"/>
72 <format name=\"srw_dc\" type=\"application/xml\" namespace_uri=\"info:srw/schema/1/dc-schema\" schema_location=\"http://www.loc.gov/z3950/agency/zing/srw/dc-schema.xsd\"/>