'."\n"; } } ?>

: (Getting answers from peer reference librarians)

Return to list of questions related to '.$query.'

'."\n"; //set base url of API $base = 'http://www.questionpoint.org/crs/servlet/org.oclc.ask.AskPatronFetchQAWS?'; $params = array( //'kbids' => 1, // number of the KB to search //'lang' => 4, // language code of retrieved records //'preflang' => 4, // language code of index to query 'qid' => $id, // ID of question to return matching answer 'type' => $format, // output format - xml, json, html, text //'andk' => $query, //'qcat' => $category, // category codes: 1 = faq, 4 = readyref, 3 = research, etc http://www.worldcat.org/devnet/wiki/QuestionPoint#Category_Codes //'sopt' => kw, limit to keywords tagged/entered by question answerers //'dr' => lm, //code for date range - Last Week (lw), Last Month (lm), Last Three Months (ltm), Last Six Months (lsm), Last Year (ly) // all possible options are documented at http://www.worldcat.org/devnet/wiki/QuestionPoint#Search_Parameters ); //for testing purposes show actual request to API - REMOVE when finished //$apiRequest = $base.http_build_query($params); //echo $apiRequest; //build request, encode entities (using http_build_query), and send to QuestionPoint Search API $request = simplexml_load_file($base.http_build_query($params)); //create xml object(s) out of response from Worldcat Search API $data = $request; //parse json elements and display as html $question = $data->question; //note for future dev: add full match statement, total number of matches echo '

See your answers...

'."\n"; echo '
'."\n"; foreach ($data as $item) { echo '
'.$item->question.'
'."\n"; echo '
'.html_entity_decode($item->answer).'
'."\n"; } echo '
'."\n"; //note for future dev: add pagination ?>