Revision: 34493
Updated Code
at November 12, 2010 15:53 by mloberg
Updated Code
<?php $flickrId = 'userId'; // Find your Flickr ID at http://idgettr.com $flickrrequest = 'http://api.flickr.com/services/feeds/photos_public.gne?id=' . $flickrId . '&format=json'; $flickrci = curl_init($flickrrequest); curl_setopt($flickrci,CURLOPT_RETURNTRANSFER, TRUE); $flickrinput = curl_exec($flickrci); curl_close($flickrci); // Flickr JSON doesn't come in standard form, some str replace needed $flickrinput = str_replace('jsonFlickrFeed(','',$flickrinput); $flickrinput = str_replace('})','}',$flickrinput); // parameter 'true' is necessary for output as PHP array $flickrvalue = json_decode($flickrinput,true); $flickritem = $flickrvalue['items']; // echo the channel information echo "<h3><a href=\"" . $flickrvalue['link'] . "\">" . $flickrvalue['title'] . "</a></h3>\n"; echo "<p>" . $flickrvalue['description'] . "</p>\n"; $photosToDisplay = 5; //change this to the number of photos you want to display for($p=0;$p<$photosToDisplay;$p++){ echo "<a href=\"" . $flickritem[$p]['link'] . "\"><img src=\"" . $flickritem[$p]['media']['m'] . "\" /></a>\n"; } echo "<p><a href=\"" . $flickrvalue['link'] . "\">View all my photos</p>\n"; ?>
Revision: 34492
Updated Code
at October 23, 2010 06:50 by mloberg
Updated Code
<?php $flickrId = 'userId'; // Find your Flickr ID at http://idgettr.com $flickrrequest = 'http://api.flickr.com/services/feeds/photos_public.gne?id=' . $flickrId . '&format=json'; $flickrci = curl_init($flickrrequest); curl_setopt($flickrci,CURLOPT_RETURNTRANSFER, TRUE); $flickrinput = curl_exec($flickrci); curl_close($flickrci); // Flickr JSON doesn't come in standard form, some str replace needed $flickrinput = str_replace('jsonFlickrFeed(','',$flickrinput); $flickrinput = str_replace('})','}',$flickrinput); // parameter 'true' is necessary for output as PHP array $flickrvalue = json_decode($flickrinput,true); $flickritem = $flickrvalue['items']; // echo the channel information echo "<h3><a href=\"" . $flickrvalue['link'] . "\">" . $flickrvalue['title'] . "</a></h3>\n"; echo "<p>" . $flickrvalue['description'] . "</p>\n"; $photosToDisplay = 5; for($p=0;$p<$photosToDisplay;$p++){ echo "<a href=\"" . $flickritem[$p]['link'] . "\"><img src=\"" . $flickritem[$p]['media']['m'] . "\" /></a>\n"; } echo "<p><a href=\"" . $flickrvalue['link'] . "\">View all my photos</p>\n"; ?>
Revision: 34491
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 23, 2010 05:51 by mloberg
Initial Code
<?php $flickrId = 'userId'; // Find your Flickr ID at http://idgettr.com $flickrrequest = 'http://api.flickr.com/services/feeds/photos_public.gne?id=' . $flickrId . '&format=json'; $flickrci = curl_init($flickrrequest); curl_setopt($flickrci,CURLOPT_RETURNTRANSFER, TRUE); $flickrinput = curl_exec($flickrci); // Flickr JSON doesn't come in standard form, some str replace needed $flickrinput = str_replace('jsonFlickrFeed(','',$flickrinput); $flickrinput = str_replace('})','}',$flickrinput); // parameter 'true' is necessary for output as PHP array $flickrvalue = json_decode($flickrinput,true); $flickritem = $flickrvalue['items']; // echo the channel information echo "<h3><a href=\"" . $flickrvalue['link'] . "\">" . $flickrvalue['title'] . "</a></h3>\n"; echo "<p>" . $flickrvalue['description'] . "</p>\n"; $photosToDisplay = 5; for($p=0;$p<$photosToDisplay;$p++){ echo "<a href=\"" . $flickritem[$p]['link'] . "\"><img src=\"" . $flickritem[$p]['media']['m'] . "\" /></a>\n"; } echo "<p><a href=\"" . $flickrvalue['link'] . "\">View all my photos</p>\n"; ?>
Initial URL
Initial Description
Initial Title
Flickr Photos Pull-In PHP JSON
Initial Tags
php, json, api
Initial Language
PHP