Skip to content

Instantly share code, notes, and snippets.

@murdaugh
Created May 16, 2012 21:37
Show Gist options
  • Save murdaugh/2714140 to your computer and use it in GitHub Desktop.
Save murdaugh/2714140 to your computer and use it in GitHub Desktop.
Flickr JSON PHP
<?php
echo flickr_feed('http://api.flickr.com/services/feeds/photos_public.gne?id=12345678@N06&format=json&nojsoncallback=1');
function flickr_feed($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$details = json_decode($output);
$i=0;
$htmlString = '';
foreach($details->items as $item) {
//DO SOMETHING AWESOME HERE WITH $htmlstring. MAKE IT PRETTY. MAKE IT COUNT.
}
return $htmlString;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment