PHP & FlickrAPI - Photo wall

I wrote a simple code/class for automatic get photos from flickr photostream (by service API) to compose randomly a nice miniature photowall (you can see an example on my homepage). First of all you can need API code (only key, we don’t need secret authentication). Now the code, my class file was called lib/fget.php in here we define variable, class and function construct: <?php class Flickr { //API Key you can get them on http://www.flickr.com/services/apps/create/apply/ private $apiKey = 'xxxx'; //We define our numeric username http://www.flickr.com/services/api/explore/?method=flickr.people.getInfo private $NSID = 'xxxx'; //File per page (max file 200 for free account) private $ppage = '400'; public function __construct() { } public function retrive() { //For get data we use REST method and serialize option $getdata = 'https://flickr.com/services/rest/?method=flickr.photos.search&api_key=' . $this->apiKey . '&user_id=' . $this->NSID . '&per_page=' . $this->ppage . '&format=php_serial'; //Get the data $result = file_get_contents($getdata); //De serialize for array use $result = unserialize($result); return $result; } } ?> Now include the class into a sample page: ...

19 March 2010 @ 03:29 · Updated: 30 June 2026 @ 03:28 · leo