Created
July 22, 2012 20:05
-
-
Save michaelminter/3160910 to your computer and use it in GitHub Desktop.
Flickr API written in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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