$HTTP_POST_VARS = &$_POST; $HTTP_GET_VARS = &$_GET; $HTTP_COOKIE_VARS = &$_COOKIE; if (! $HTTP_GET_VARS['pgNum']) { $pgNum = 1; } else { $pgNum =$HTTP_GET_VARS['pgNum']; } if (! $HTTP_GET_VARS['word']) { $word = "flickr rules"; } else { $word =$HTTP_GET_VARS['word']; } if (! $HTTP_GET_VARS['numResults']) { $numResults = 250; } else { $numResults =$HTTP_GET_VARS['numResults']; } $tags = explode(" ",$word); foreach($tags as $ba){ $taglist .= "$ba,"; } $taglist = trim($taglist,","); /* sort (Optional) The order in which to sort returned photos. Deafults to date-posted-desc. The possible values are: date-posted-asc, date-posted-desc, date-taken-asc, date-taken-desc, interestingness-desc, interestingness-asc, and relevance */ $params = array( 'api_key' => '97281e87ae7c50f5b430f1e45290e167', 'method' => 'flickr.photos.search', 'text' => $word, 'tags' => $taglist, 'per_page' => $numResults, 'page' => $pgNum, 'sort' => 'relevance', 'format' => 'php_serial', ); $encoded_params = array(); foreach ($params as $k => $v){ $encoded_params[] = urlencode($k).'='.urlencode($v); } # # call the API and decode the response # $url = "http://api.flickr.com/services/rest/?".implode('&', $encoded_params); $rsp = file_get_contents($url); $rsp_obj = unserialize($rsp); ?>