This is an old revision of the document!
<?php // hatop@ub.uni-marburg.de 2008-12-08 2009-12-03 // http://unapi.info/specs/ /* Copyright 2008 2009 Goetz Hatop * Goetz Hatop's original Version can be found at * <ftp://ftp.ub.uni-marburg.de/pub/research/unapi.tar.gz> */ /* Copyright 2009 Stephan Rosenke <rosenke@ulb.tu-darmstadt.de> */ /* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Version: 0.1 */ /* Changelog * * 20091210: Put class Picappn to PicaRecord.php. * Inserted conditional for textual output of array. * Ordered final switch() alphabetically. * Added format "plain", renamed "picaplus" to "extpp". Put header() in the case-loops in final switch(). * 20091210: Started with Goetz Hatop's version of 2009-12-08 */ require('PicaRecord.php'); $noparam = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <formats> <format name=\"extpp\" type=\"application/xml\" /> <format name=\"xml\" type=\"application/xml\" /> <format name=\"dc\" type=\"application/xml\" /> <format name=\"rdf\" type=\"application/xml\" /> </formats> "; $idparam = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <formats id=\"info:pica/004\"> <format name=\"text\" type=\"text/plain\" /> </formats> "; if (!isset($_GET[id]) || $_GET[id]=='') { header('Content-type: application/xml'); echo "$noparam"; return; } $pica = new Picappn(); //$pica->setOpac("http://opac.ub.uni-marburg.de/XML=1.0/PPN?PPN="); //$pica->setOpac("http://cbsopac.rz.uni-frankfurt.de/XML=1.0/PPN?PPN="); //$pica->setOpac("http://gso.gbv.de/XML=1.0/PPN?PPN="); $pica->setPpn( $_GET[id] ); if ($_GET[format] == "array") { echo "<head></head>\n<body>\n <pre>\n"; print_r($pica->getArray()); echo " </pre>\n</body>\n"; die(0); } switch ($_GET[format]) { case 'dc': header('Content-type: application/xml'); echo $pica->getDublinCore(); break; case 'extpp': header('Content-type: application/xml'); echo $pica->getPicaPlus(); break; case 'plain': echo $pica->getPlain(); break; case 'rdf': header('Content-type: application/xml'); echo $pica->getDublinCoreRDF(); break; case 'text': header('Content-type: text/plain'); echo $pica->getText(); break; case 'xml': header('Content-type: application/xml'); echo $pica->getXmlData(); break; default: header('Content-type: application/xml'); echo "$idparam"; break; } ?>