Return to list of questions related to '.$query.''."\n";
//set base url of for LCSH API terminologies service
/*http://tspilot.oclc.org/lcsh/?
query=oclcts.preferredTerm+any+%22beef+cattle+weight%22
&version=1.1
&operation=searchRetrieve
&recordSchema=http://zthes.z3950.org/xml/1.0/
&maximumRecords=10
&startRecord=1
&resultSetTTL=300
&recordPacking=xml
&recordXPath=
&sortKeys=*/
/*$base = 'http://tspilot.oclc.org/lcsh/?';
$params = array(
'query' => 'oclcts.preferredTerm+any+"'.$query.'"', //set query type and allow for all matching words
'version' => 1.1, // API version for OCLC terminologies
'operation' => 'searchRetrieve', //set type of search operation to preform
'recordSchema' => 'http://zthes.z3950.org/xml/1.0/', //format schema of API result
'maximumRecords' => $limit, //set number of results to return
'startRecord' => 1, //set starting record number (pagination)
'resultSetTTL' => 300, //set bounds of result set
'recordPacking' => 'xml', //set format of result
'recordXPath' => '', //set xpath expression
'sortKeys' => '', //set sort for records
//all possible options are documented at http://www.worldcat.org/devnet/wiki/Terminologies AND http://tspilot.oclc.org/resources/index.html
//test LCSH queries at http://tspilot.oclc.org/lcsh/?operation=explain&version=1.1
);*/
$request = 'http://tspilot.oclc.org/lcsh/?query=oclcts.preferredTerm+any+%22'.urlencode($query).'%22&version=1.1&operation=searchRetrieve&recordSchema=http://zthes.z3950.org/xml/1.0/&maximumRecords='.$limit.'&startRecord=1&resultSetTTL=300&recordPacking=xml&recordXPath=&sortKeys=';
//for testing purposes show actual request to API - REMOVE when finished
//echo $request;
//build request, encode entities (using http_build_query), and send to Terminologies API
$data = simplexml_load_file($request);
//parse xml elements and display as html
echo '
Related terms for your query of '.$query.'
'."\n";
echo '
'."\n";
?>