document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php
  2.  
  3. #Bring the multiple API call XMLs into the environment.
  4. $call1 = simplexml_load_file("http://api.flickr.com/services/rest/?&method=flickr.photosets.getPhotos&api_key=[your flickr API key]&photoset_id=[the photoset ID]");
  5. $call2 = simplexml_load_file("http://api.flickr.com/services/rest/?&method=flickr.photosets.getPhotos&api_key=[your flickr API key]&photoset_id=[the photoset ID]");
  6. $calln = simplexml_load_file("http://api.flickr.com/services/rest/?&method=flickr.photosets.getPhotos&api_key=[your flickr API key]&photoset_id=[the photoset ID]");
  7.  
  8. #Create the atom feed
  9. echo "<?xml version=\'1.0\' encoding=\'utf-8\' ?> \\n"; 
  10. echo "<feed xml:lang=\'en-US\' xmlns=\'http://www.w3.org/2005/Atom\'> \\n";
  11. echo "<title>";
  12. echo "Misc";
  13. echo "</title> \\n";
  14. echo "<link href=\'http://greg.mcmull.in\' rel=\'self\'/> \\n";
  15. echo "<author>";
  16. echo "<name>Greg McMullin</name> \\n";
  17. echo "<email>greg@mcmcull.in</email> \\n";
  18. echo "</author> \\n";
  19.  
  20. #use the function defined below to create the atom entries for each of the photos in the API call XMLs
  21. writeEntries($call1);
  22. writeEntries($call2);
  23. writeEntries($calln);
  24.  
  25. echo "</feed>";
  26.  
  27. #Create an function to make an entry for each photo returned by the multipe API calls
  28. function writeEntries($whatever){
  29.    foreach ($whatever->photoset as $photos) {
  30.       foreach ($photos->photo as $photo) {
  31.          echo "<entry>";
  32.          echo "<title>";
  33.          echo htmlentities($photo["title"]);
  34.          echo "</title>";
  35.          echo "<link rel=\'enclosure\' type=\'image/jpeg\' href=\'http://farm{$photo["farm"]}.static.flickr.com/{$photo["server"]}/{$photo["id"]}_{$photo["secret"]}_b.jpg\' />";
  36.          echo "</entry> \\n";
  37.       };
  38.    }
  39. }
  40.  
  41. ?>
');