Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Corey W.  >  Flickr API Wrapper  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Usage
Class: Flickr API Wrapper
Send requests to the Flickr API
Author: By
Last change: added <?php for code highlighting
Date: 2009-07-27 16:00
Size: 695 bytes
 

Contents

Class file image Download
<?php

$api_key 
'your_flickr_api_key_here';

$flickr = new Flickr($api_key);

$params = array
(
    
'user_id'  => 'your_flickr_user_nsid',
    
'extras'   => 'url_m,url_sq',
    
'per_page' => 10,
);

$result $flickr->call('people.getPublicPhotos'$params);

foreach (
$result->photos->photo as $photo)
{
    
$p $flickr->call('photos.getInfo', array('photo_id' => $photo->id));

    echo 
'<h2>'.$photo->title.'</h2>';
    echo 
'<a href="'.$photo->url_m.'"><img src="'.$photo->url_sq.'" alt="" /></a><br />';
    echo 
nl2br($p->photo->description->_content);
}

// Example using chaining

$result Flickr::factory($api_key)->call('people.getPublicPhotos'$params);