Advertisement
Guest User

Untitled

a guest
Sep 15th, 2011
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1. <?php
  2.  
  3. #Bring the API call XMLs into the environment.
  4. $photoset_info = simplexml_load_file("http://api.flickr.com/services/rest/?&method=flickr.photosets.getInfo&api_key=[your flickr API key&photoset_id=[the ID of the photoset]");
  5. $photoset_photos = simplexml_load_file("http://api.flickr.com/services/rest/?&method=flickr.photosets.getPhotos&api_key=[your flickr API key&photoset_id=[the ID of the photoset]");
  6.  
  7. #Atom feed header
  8. echo "<?xml version='1.0' encoding='utf-8' ?> \n"; 
  9. echo "<feed xml:lang='en-US' xmlns='http://www.w3.org/2005/Atom'> \n";
  10. echo "<title>";
  11. echo htmlentities($photoset_info->photoset->title);
  12. echo "</title> \n";
  13. echo "<link href='http://greg.mcmull.in' rel='self'/> \n";
  14. echo "<author>";
  15. echo "<name>Greg McMullin</name> \n";
  16. echo "<email>greg@mcmcull.in</email> \n";
  17. echo "</author> \n";
  18.  
  19. #Create an entry for each photo returned by the API
  20. foreach ($photoset_photos->photoset as $photos) {
  21. foreach ($photos->photo as $photo) {
  22. echo "<entry>";
  23. echo "<title>";
  24. echo htmlentities($photo["title"]);
  25. echo "</title>";
  26. echo "<link rel='enclosure' type='image/jpeg' href='http://farm{$photo["farm"]}.static.flickr.com/{$photo["server"]}/{$photo["id"]}_{$photo["secret"]}_b.jpg' />";
  27. echo "</entry> \n";
  28. };
  29. }
  30.  
  31. echo "</feed>";
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement