Research Links: List of Databases, Course Reserves

Quick Search: Articles, newspapers, books and ebooks, videos and more. Results primarily available online but may also include books available in the library or articles that can be requested for email delivery from ILLiad.
Books: Print and online books available from UNLV Libraries or by ILLiad request.
Articles: Articles from academic journals, magazines and newspapers.

Library Information: Pages on library web site, for example research guides, library policies and procedures, hours and events.

Quick and easy OAI record parsing with PHP

By Alex Dolski on February 11, 2009 8:17 AM | Permalink

Welcome to the second post on our blog! I'm the Web & Digitization Application Developer (a.k.a. junior programmer), which means that my posts will be the most important. Before I begin, a shout-out to all my dead homies. Now that that's out of the way, I can proceed.

If you work with metadata in a digital repository, the time may come when you need to export it for other purposes. Your repository software may or may not make that easy for you; but as long as it supports OAI-PMH, it's both possible and simple to do in a standards-compliant way. To do the job, we will use PHP's DOM core; this is one of several ways to work with XML in PHP. It can, of course, also be done in any other common scripting language.


<?php

$qs = array(
   'verb' => 'ListRecords',
   'metadataPrefix' => 'oai_dc',
   'set' => 'hughes'
);

$url = 'http://digital.library.unlv.edu/cgi-bin/oai.exe?'
   . http_build_query($qs);
$xml = file_get_contents(utf8_encode($url));
if (!$doc = DOMDocument::loadXML($xml)) {
   // abort
}

$xpath = new DOMXPath($doc);
$xpath->registerNamespace("dc",
   "http://purl.org/dc/elements/1.1/");

?>


<dl>
   <!-- The query() method returns a DOMNodeList object
   (an array-like list of DOMNodes). The first parameter is
   an XPath query. -->
   <? foreach ($xpath->query('//dc:*', $doc) as $node): ?>
      <dt><?= $node->nodeName ?></dt>
      <dd><?= $node->nodeValue ?></dd>
   <? endforeach ?>
</dl>

From here, you can do anything with it - print it to the screen, save it to a database, export it to a spreadsheet, etc. Handy. You can also fetch just a single record, using GetRecord in place of ListRecords:

$qs = array( 
   'verb' => 'GetRecords', 
   'metadataPrefix' => 'oai_dc', 
   'identifier' => 'oai:digital.library.unlv.edu:hughes/87' 
);

A mobot - who wouldn't want one?

There is more information in the OAI record than just the DC fields; to access it, just register the necessary namespace(s) and modify the XPath query. You can always take a look at the contents of $xml to see the raw XML string.

Comments

Submitted by faisal khan (not verified) on
Informative article for <a href="https://www.sagipl.com/php-development/">PHP Development</a> thanx for sharing it
Submitted by PHP Development... (not verified) on
Hey, Wow all the posts are very informative for the people who visit this site. Good work! We also have a Blog.Please feel free to visit our site. Thank you for sharing. <a href="https://www.paravidhi.com/website-development.html" rel="do follow" meta name="robots" content="index, follow" title="PHP Development in Indore">PHP Development in Indore</a>
Submitted by Balkon Hotel (not verified) on
Nice Post and good information
Submitted by Pak Datuk (not verified) on
<a href='https://balkonhotel.com/'>BalkonHotel</a>
Submitted by dexica (not verified) on
Generic cialis online canada <a href="http://cialisndbrx.com/#">buy cialis online</a> generic cialis free shipping <a href="http://cialischmrx.com/#">buy cheap cialis online</a> manly cialis tablets <a href="http://cialischbrx.com/#">buy generic cialis online</a> prices cialis <a href="http://cialisdbrx.com/#">buy cheap cialis online</a> viagra 911 call <a href="http://chviagranrxusa.com/#">buy generic viagra online</a>
Submitted by elurbeft (not verified) on
<a href="http://cashpaydayusloans.com/#">loans online</a> <a href="http://cialischbrx.com/#">buy cialis online</a> <a href="http://cialisbs.com/#">generic cialis online</a> <a href="http://cialismnrx.com/#">buy generic cialis</a> <a href="http://calismdmrxonline.com/#">cialis</a>
Submitted by tobSkent (not verified) on
Cialis cheap generic <a href="http://cialisgenbrx.com/#">buy generic cialis</a> brand cialis name online order <a href="https://cialisrxche.com/#">cheap cialis online</a> personal secured loan <a href="http://paydaystip.com/#">personal loans</a>
Submitted by NopsFaps (not verified) on
Buy canada cialis <a href="http://cialisgenbrx.com/#">generic cialis online</a> prednisone crush cialis generic pills <a href="https://cialisrxche.com/#">cheap cialis</a> need 5000 loan <a href="http://paydaystip.com/#">fast cash</a>
Submitted by LacakPos (not verified) on
Thanks [url]https://www.lacakresipos.online[/url]
Submitted by trapeure (not verified) on
Generic professional cialis cialis <a href="http://cialischmrx.com/#">generic cialis online</a> official site cialis pills <a href="http://cialisdbrx.com/#">buy generic cialis online</a>
Submitted by vafpesia (not verified) on
Uroxatral vs hytrin cialis pills <a href="http://mrxcialisrx.com/#">cialis coupon</a> viagra blue pill <a href="http://viagramrxgeneric.com/#">buy viagra online</a>
Submitted by Expona (not verified) on
Generic cialis price <a href="http://cialisherrx.com/#">cheap cialis</a> is cialis available in generic <a href="http://cialismdmarx.com/#">buy cialis online</a>
Submitted by Dwentown (not verified) on
Buy viagra online <a href="http://chviagranrxusa.com/#">buy generic viagra</a> hot rod cialis pills buy <a href="http://cialismnrx.com/#">buy generic cialis</a>
Submitted by speeday (not verified) on
Order cialis online without medical <a href="http://cialismrxcialis.com/#">generic cialis</a> viagra from canada <a href="http://genviagramdmrx.com/#">buy generic viagra</a>
Submitted by Buffnevy (not verified) on
Buy cialis online pharmacy <a href="http://4ginthebox.com/#">generic cialis</a> order cialis online without otc <a href="http://babysitterpass.com/#">cheap cialis online</a> taking without ed cialis pills cialis <a href="http://extra-casting.com/#">buy cheap cialis coupon</a> holland cialis pills <a href="http://jahanews.com/#">cialis generic</a> levaquin inhaler cialis pills <a href="http://fpdvermont.org/#">buy cialis online cheap</a> where to buy cialis
Submitted by geosycle (not verified) on
Cialis generic cheap <a href="http://gamingpcunder.com/#">buy cialis cheap</a> cialis canadian pharmacy cheap buy <a href="http://buteykobreathing.com.au/#">cialis cheap</a> viagra v levitra cialis pills <a href="http://frommydiamondeye.com/#">Buy Generic Cialis Online</a> benefits of cialis generic drugs <a href="http://bettychoyce.com/#">cheap generic cialis</a> get cialis prescription and order cialis online <a href="http://100halloweencards.com/#">online cialis</a> price of cialis pills
Submitted by Jeseemon (not verified) on
Buy cialis generic pharmac <a href="http://badcreditpaydayloanuqdirect.com/#">Buy Cialis Online</a> buy cialis europe <a href="http://dcbarr.com/#">buy cialis</a> cialis pharmacy discount <a href="http://pickleball247.com/#">buy cialis</a> next day brand cialis only online <a href="http://eshta.org/#">buy generic cialis</a> medco cialis online pharmacy viagra <a href="http://cashscripter.com/#">cheap cialis</a> generic cialis pro
Submitted by Bychova (not verified) on
Sex cialis pills <a href="http://bestk.net/#">cialis generic</a> yasmin light headed cialis pills <a href="http://100halloweencards.com/#">cialis generic</a> lowest price generic cialis online pharmacy <a href="http://cremenoncreme.it/#">cialis coupon</a> cialis pills discount cialis <a href="http://frommydiamondeye.com/#">online cialis</a> purchase cialis online <a href="http://concourse.co/#">buy cheap cialis</a> cialis generic price
Submitted by Ionite (not verified) on
Cialis coupons <a href="http://incoasterpaedia.com/#">cialis cost</a> free cialis pills <a href="http://globalkos.org/#">buy cialis online cheap</a> cialis tablets 20mg <a href="http://foxmarkers.info/#">Buy Cheap Cialis Online</a> how long does cialis 20mg <a href="http://golfballs101.com/#">Buy Generic Cialis Online</a> cialis online pharmacy canada <a href="http://4everheatingandcooling.com/#">Buy Generic Cialis Online</a> natural forms of viagra cialis pills cialis
Submitted by fluero (not verified) on
Prices cialis <a href="http://fightingarena.org/#">buy generic cialis online</a> online pharmacy cialis <a href="http://bubib.com/#">cheap generic cialis</a> name cialis tablets <a href="http://drivesentinel.co.uk/#">Buy Generic Cialis Online</a> generic cialis without prescription <a href="http://michael-parent.com/#">buy cialis cheap</a> cheap cialis australia <a href="http://chilecitonews.com/#">buy cialis generic</a> cialis online cheap
Submitted by tafElent (not verified) on
Cheapest generic cialis online <a href="http://cialisherrx.com/#">buy cialis online</a> how long does cialis 20mg cialis <a href="http://cialismdmarx.com/#">buy cialis</a>
Submitted by Dwentown (not verified) on
Buy tadalafil online cialis <a href="http://cialismrxcialis.com/#">cialis online</a> herbal viagra side effects <a href="http://genviagramdmrx.com/#">viagra</a>
Submitted by ZenClulp (not verified) on
Viagra daily <a href="http://chviagranrxusa.com/#">generic viagra</a> viagra rap buy cialis online <a href="http://cialismnrx.com/#">cheap cialis</a>
Submitted by Neilync (not verified) on
Viagra v levitra cialis pills cialis a <a href="http://cialischmrx.com/#">buy cialis online</a> quality of generic cialis online pharmacy <a href="http://cialisdbrx.com/#">cialis generic</a>
Submitted by antalse (not verified) on
Buy cheap generic cialis online cialis <a href="http://cialischbrx.com/#">generic cialis online</a> cialis 5mg price prescript <a href="http://cialisknfrx.com/#">generic cialis</a>
Submitted by twercog (not verified) on
Buy geneA­ric ciaA­lis <a href="http://mrxcialisrx.com/#">cialis online</a> viagra use <a href="http://viagramrxgeneric.com/#">viagra online</a>
Submitted by Gilbertaling (not verified) on
Nicely put. Thank you. lisinopril hctz 12.5 no persription <a href="http://lisinopriltrust.com/">no prescription needed lisinopril</a> buy cheap lisinopril <a href="http://lisinopriltrust.com/#">natural substitute for lisinopril</a>
Submitted by Gilbertaling (not verified) on
Very good content. With thanks. purchase lisinopril 40 mg <a href="http://lisinopriltrust.com/">lisinopril 20 mg</a> lisinopril hctz from canada <a href="http://lisinopriltrust.com/#">lisinopril recall 2013</a>
Submitted by Gilbertaling (not verified) on
You mentioned this effectively. buy lisinopril 5mg <a href="http://lisinopriltrust.com/">lisinopril 20 mg without prescription</a> online pharmacy lisinopril <a href="http://lisinopriltrust.com/#">lisinopril 20 mg</a>
Submitted by Gilbertaling (not verified) on
Incredible a good deal of beneficial advice. lisinopril hctz 20-12.5 mgs <a href="http://lisinopriltrust.com/">lisinopril medication</a> lisinopril on line no perscription <a href="http://lisinopriltrust.com/#">lisinopril hctz</a>
Submitted by Gilbertaling (not verified) on
You made your stand pretty effectively!. no prescription online lisinopril hctz <a href="http://lisinopriltrust.com/">Lisinopril uk</a> lisinopril over the counter <a href="http://lisinopriltrust.com/#">prinivil medication</a>
Submitted by Gilbertaling (not verified) on
Kudos! Plenty of forum posts. no prescription lisinopril 2.5mg <a href="http://lisinopriltrust.com/">lisinopril medication</a> lisinopril 20mg tab internl lb <a href="http://lisinopriltrust.com/#">lisinopril</a>
Submitted by junk car buyer ... (not verified) on
I like this website because so much utile material on here . junk car buyer houston http://ow.ly/spJd50x1rrG
Submitted by xwmoasqqyh (not verified) on
ivrcejmhozidjqgtateitakvpzkdsv

Pages

Add new comment