Skip to content

Instantly share code, notes, and snippets.

@michaelminter
Created July 22, 2012 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelminter/3160910 to your computer and use it in GitHub Desktop.
Save michaelminter/3160910 to your computer and use it in GitHub Desktop.
Flickr API written in PHP
$api = 'your-32-byte-api-key-courtesy-Flickr';
$user_id = '33822702%40N08';
$per_page = 10;
$xml = 'http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key='.$api.'&user_id='.$user_id.'&per_page='.$per_page;
$flickr = simplexml_load_file($xml);
foreach($flickr->photos->photo as $p) {
echo '<a href="http://www.flickr.com/photos/'.$p['owner'].'/'.$p['id'].'">';
echo '<img src="http://farm'.$p['farm'].'.static.flickr.com/'.$p['server'].'/'.$p['id'].'_'.$p['secret'].'_s.jpg">';
echo '</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment