60 ) { $minutes = $seconds/60; } else { return add_s($seconds,'second'); } if ( $minutes >= 60 ) { $hours = $minutes/60; } else { return add_s($minutes,'minute'); } if ( $hours >= 24) { $days = $hours/24; } else { return add_s($hours,'hour'); } if ( $days >= 7 ) { $weeks = $days/7; } else { return add_s($days,'day'); } if ( $weeks >= 4 ) { $months = $weeks/4; } else { return add_s($weeks,'week'); } if ( $months>= 12 ) { $years = $months/12; return add_s($years,'year'); } else { return add_s($months,'month'); } } function add_s($num,$word) { $num = floor($num); if ( $num == 1 ) { return $num.' '.$word.' ago'; } else { return $num.' '.$word.'s ago'; } } ?> <?php echo($pageTitle); ?> : Montana State University Libraries '."\n"; } } ?>

: (working code and proof of concepts)

'ENTER YOUR WORLDCAT API KEY HERE', //worldcat API key 'servicelevel' => 'full', //worldcat api service level 'format' => 'atom', //type of format to output 'cformat' => 'mla', //type of citation format to output 'start' => $start, //record result number to start from 'count' => $count, //number of results to return 'q' => trim(strip_tags($q)), //query to search //'version' => '1.1', //worldcat api version //'operation' => 'searchRetrieve', //worldcat api operation //'recordSchema' => 'info:srw/schema/1/dc', //type of record schema to output //'maximumRecords' => $count, //number of results to return //'startRecord' => $start, //record result number to start from //'recordPacking' => 'xml', //type of format to output //'sortKeys' => 'Date,,0', //sort parameters - this is date descending; other options: relevance, Author, Title, Date, Score, LibraryCount //'resultSetTTL' => '300', //default set results //'query' => 'srw.kw+all+'.$q.'+and+srw.su+all+'.$q.', //all possible options are documented at http://worldcat.org/devnet/wiki/SearchAPIDetails ); //echo $base.http_build_query($params); //build request, encode entities (using http_build_query), and send to Worldcat Search API $request = simplexml_load_file($base.http_build_query($params)); //echo $base.http_build_query($params); //prepare opensearch namespace for parsing $opensearch = $request->children('http://a9.com/-/spec/opensearch/1.1/'); $subtitle = $request->subtitle; $totalResults = $opensearch->totalResults; if ($totalResults > 0): ?>

READ (from Worldcat)
out of a possible matches for your query ""

    children('http://purl.org/dc/elements/1.1/'); foreach ($request->entry as $entry) { $title = htmlentities($entry->title); $creator = htmlentities($entry->author->name); $cite = htmlentities($entry->content); $url = $entry->id; //get unique video id //$arr = explode('/',$entry->id); //$id = $arr[count($arr)-1]; //get nodes in media: namespace for media information //$media = $entry->children('http://search.yahoo.com/mrss/'); //get video player URL //$attrs = $media->group->player->attributes(); //$watch = $attrs['url']; //prepare oclc namespace for parsing $oclc = $entry->children('http://purl.org/oclc/terms/'); $oclcNumber = $oclc->recordIdentifier; //prepare dublin core namespace for parsing $dc = $entry->children('http://purl.org/dc/elements/1.1/'); //get isbn if ($dc->identifier != '') { $isbn = explode(":", $dc->identifier[0]); $isbn = $isbn[2]; } else { $isbn = 'not available'; $thumbnail = 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/meta/img/thumbnail-default.gif'; } if ($isbn != 'not available') { $remoteImageUrl = 'http://covers.openlibrary.org/b/isbn/'.$isbn.'-S.jpg'; list($width, $height) = getimagesize($remoteImageUrl); //echo $width; if ($width > 30){ //thumbnail available $thumbnail = $remoteImageUrl; }else{ //set default thumbnail $thumbnail = 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/meta/img/thumbnail-default.gif'; } } ?>
  1. <?php echo $title; ?>

    ISBN:
    OCLC #:

No Worldcat.org results for .

Reset the page

'flickr.photos.search', //flickr api request method 'api_key' => 'ENTER YOUR FLICKR API KEY HERE', //flickr API key 'extras' => 'url_sq,url_m,url_z,url_l', //type of image format to output 'page' => $start, //record result number to start from 'per_page' => $count, //number of results to return 'text' => trim(strip_tags($q)), //query to search //'version' => '1.1', //flickr api version //'secret' => '977f80b7e4bbc7c6', //flickr api secret for this app //'format' => 'atom', //type of format to output //http://www.flickr.com/services/api/ ); //echo $base.http_build_query($params); //build request, encode entities (using http_build_query), and send to Worldcat Search API $request = simplexml_load_file($base.http_build_query($params)); //echo $base.http_build_query($params); $totalResults = $request->photos[total]; if ($totalResults > 0): ?>

SEE (from Flickr)
out of a possible matches for your query ""

    photos->photo as $entry) { $title = $entry['title']; $thumbnail = $entry['url_sq']; $id = $entry['id']; $image = $entry['url_z']; ?>
  1. <?php echo $title; ?>

    id:

No Flickr.com results for .

Reset the page

$lat, //latitude setting 'find[longitude]' => $lng, //longitude setting 'page[number]' => $start, //record result number to start from 'page[items]' => $count, //number of results to return //'version' => '1.1', //api version //audioboo.fm api docs at http://code.google.com/p/audioboo-api/ ); //build request, encode entities (using http_build_query), and send to audioboo.fm API $request = simplexml_load_file($base.http_build_query($params)); echo $base.http_build_query($params); $totalResults = $request->body->totals->count; if ($totalResults > 0): ?>

Hear (from audioboo.fm)
out of a possible matches for your query ""

    body->audio_clips->audio_clip as $entry) { $id = $entry->id; $title = $entry->title; $duration = $entry->duration; $date = $entry->uploaded_at; $audio = $entry->urls->high_mp3; $thumbnail = $entry->urls->image; $lat = $entry->location->latitude; $lng = $entry->location->longitude; ?>
  1. <?php echo $title; ?>

    duration:

    location: ,

    date:

    id:

No audioboo.fm results for .

Reset the page

$version, //api version 'geocode' => "$lat,$lng,$radius", //latitude setting,longitude setting 'page' => $start, //record result number to start from 'rpp' => $count, //number of results to return //'q' => trim(strip_tags($q)), //query to search //twitter.com search api docs at http://dev.twitter.com/doc/get/search ); //build request, encode entities (using http_build_query), and send to audioboo.fm API $request = simplexml_load_file($base.http_build_query($params)); //echo $base.http_build_query($params); //prepare opensearch namespace for parsing $opensearch = $request->children('http://a9.com/-/spec/opensearch/1.1/'); $itemsPerPage = $opensearch->itemsPerPage; if ($itemsPerPage > 0): ?>

Talk (from twitter.com)
of the latest tweets matching your query " ( radius)"

    entry as $entry) { $title = $entry->title; $creator = $entry->author->name; $content = html_entity_decode($entry->content); //prepare opensearch namespace for parsing $google = $entry->children('http://base.google.com/ns/1.0'); $location = $google->location; $id = $entry->id; $published = $entry->published; $tweet = $entry->link[0]->attributes()->href; $thumbnail = $entry->link[1]->attributes()->href; ?>
  1. <?php echo $creator; ?>

    location:

No twitter.com results for .

Reset the page

'2', //api version 'location' => "$lat,$lng", //latitude setting,longitude setting 'location-radius' => '100km',//location-radius setting 'start-index' => $start, //record result number to start from 'max-results' => $count, //number of results to return 'q' => trim(strip_tags($q)), //query to search //youtube.com api docs at http://code.google.com/apis/youtube/2.0/reference.html ); //build request, encode entities (using http_build_query), and send to audioboo.fm API $request = simplexml_load_file($base.http_build_query($params)); //echo $base.http_build_query($params); //prepare opensearch namespace for parsing $opensearch = $request->children('http://a9.com/-/spec/opensearch/1.1/'); $totalResults = $opensearch->totalResults; if ($totalResults > 0): ?>

Watch (from youtube.com)
out of a possible matches for your query ""

    entry as $entry) { $title = htmlentities($entry->title); $creator = htmlentities($entry->author->name); $description = htmlentities($entry->content); $url = $entry->id; $date = $entry->published; //get unique video id //$arr = explode('/',$entry->id); //$id = $arr[count($arr)-1]; //get nodes in geo:rss namespace for location information //$geo = $entry->children('http://www.georss.org/georss'); //$gml = $geo->children('http://www.opengis.net/gml'); //$locationTemp = $geo->where; //$location = $geo->where->$gml->Point->pos; //$entry->registerXPathNamespace('georss', 'http://www.georss.org/georss'); //$entry->registerXPathNamespace('gml', 'http://www.opengis.net/gml'); //$location = $entry->xpath('/georss:where/gml:Point/gml:pos'); //get nodes in media: namespace for media information $media = $entry->children('http://search.yahoo.com/mrss/'); //get video player URL $attrs = $media->group->player->attributes(); $watch = $attrs['url']; //get video description if ($media->group->description && $media->group->description != '') { $description = $media->group->description; } else { $description = 'No description available.'; } //get video player URL $attrs = $media->group->player->attributes(); $watch = $attrs['url']; //get video thumbnail $attrs = $media->group->thumbnail[0]->attributes(); $thumbnail = $attrs['url']; //get node for video duration $yt = $media->children('http://gdata.youtube.com/schemas/2007'); $attrs = $yt->duration->attributes(); $duration = date("i:s",intval($attrs['seconds'])); $id = $yt->videoid; ?>
  1. <?php echo $title; ?>

    date:

    duration:

    url:

    id:

No youtube.com results for .

Reset the page