*/ // Default text for COinS $text = ''; /* * * DO NOT MESS BEHIND THIS LINE * */ // include some objects and methods require_once 'unAPI.inc.php'; // make some GET-variables a little bit handier $id = $_GET['id']; // check if $id is not empty if (!isset($id) || $id == '') { header('HTTP/1.0 406 Not Acceptable'); echo "406: Not Acceptable"; return; } // instantiate new Picappn() $pica = new Picappn(); // set PPN as identifier $pica->setPpn($id); // get OpenURL in KEV format $res = $pica->getOpenUrlKev(); // check if $res is not empty and return COinS with JavaScript if (!isset($res) || $res == '') { header('HTTP/1.0 406 Not Acceptable'); return; } else { echo 'document.write("<span class=\\"Z3988\\" title=\\"' . $res . '\\">' . $text . '</span>")'; }
/* * Output if no id-parameter or no parameter at all is given. * Plain-format is not announced. */ $noparam = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<formats>\n<format name=\"bibtex\" type=\"text/plain\" />\n<format name=\"csv\" type=\"text/plain\" />\n<format name=\"dc\" type=\"application/xml\" />\n<format name=\"extpp\" type=\"application/xml\" />\n<format name=\"json\" type=\"application/json\" />\n<format name=\"openurl-kev\" type=\"text/plain\" />\n<format name=\"rdf\" type=\"application/xml\" />\n<format name=\"text\" type=\"text/plain\" />\n<format name=\"xml\" type=\"application/xml\" />\n</formats>\n"; /* * check if $id is not empty, if it's empty show * available formats. */ if (!isset($id) || $id == '') { header('Content-type: application/xml'); echo "{$noparam}"; return; } // instantiate new Picappn() $pica = new Picappn(); // set PPN as identifier $pica->setPpn($id); /* * This is no part of the unAPI but for debugging. * It is triggered by supplying "array" as $format and print_rs the * pica-data as array. */ if ($format == "array") { echo "<head></head>\n<body>\n <pre>\n"; print_r($pica->getArray()); echo " </pre>\n</body>\n"; die(0); } // Final switch for printing result according to $format switch ($format) {
* <a href="http://example.com/Bibsonomy.php?id=123">Bibsonomy</a> */ /* * * DO NOT MESS BEHIND THIS LINE * */ // include some objects and methods require_once 'unAPI.inc.php'; // make some GET-variables a little bit handier $id = $_GET['id']; // check if $id is not empty if (!isset($id) || $id == '') { header('HTTP/1.0 406 Not Acceptable'); echo "406: Not Acceptable"; return; } // instantiate new Picappn() $pica = new Picappn(); // set PPN as identifier $pica->setPpn($id); // get URL for redirecting to Bibsonomy $res = $pica->getBibsonomy(); // check if $res is not empty and do redirect if (!isset($res) || $res == '') { header('HTTP/1.0 406 Not Acceptable'); echo "406: Not Acceptable"; return; } else { header("Location: {$res}"); }