OCLC Developer Network

PHP Function for WorldCat API OpenSearch Requests

Description

Given OpenSearch parameter values and a valid OCLC web service key, formats a WorldCat API OpenSearch request URL, gets a request response, transforms the response into a PHP Array, and returns the array.

This function assumes the use of a PHP RSS parser, in this instance the MagpieRSS parser (http://magpierss.sourceforge.net/).

worldcat_opensearch( string $key, string $query, string $format, string $start, string $count, string $cformat);

Download the Code

Code is available from the Developer Network Subversion repository

Parameters

  • $key = The WorldCat Search API key assigned by OCLC
  • $query = Search query terms
  • $format = rss or atom (default)
  • $start = Starting record position
  • $count = Maximum number of records per response (no more than 50)
  • $cformat = The preferred citation format: apa, chicago, harvard, mla, or turabian

Return Values

This function returns null (for zero results and any request errors) or an array of one or more records, each record represented by an array with these values:

  • title = The item title
  • author = The author name, if any
  • summary = A summary of the item, if available
  • link = A link to the item in WorldCat.org
  • content = An encoded HTML string representing the item in the specified citation format

Follow the OCLC Developer Network:

The OCLC Developer Network supports the use of OCLC Web Services—a set of tools and APIs that expose data and services for WorldCat and our member libraries and partner institutions or companies. learn more »

© 2010 OCLC Domestic and international trademarks and/or service marks of OCLC Online Computer Library Center, Inc. and its affiliates


Powered by Drupal, an open source content management system