Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- #Bring the multiple API call XMLs into the environment.
- $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]");
- $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]");
- $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]");
- #Create the atom feed
- echo "<?xml version='1.0' encoding='utf-8' ?> \n";
- echo "<feed xml:lang='en-US' xmlns='http://www.w3.org/2005/Atom'> \n";
- echo "<title>";
- echo "Misc";
- echo "</title> \n";
- echo "<link href='http://greg.mcmull.in' rel='self'/> \n";
- echo "<author>";
- echo "<name>Greg McMullin</name> \n";
- echo "<email>greg@mcmcull.in</email> \n";
- echo "</author> \n";
- #use the function defined below to create the atom entries for each of the photos in the API call XMLs
- writeEntries($call1);
- writeEntries($call2);
- writeEntries($calln);
- echo "</feed>";
- #Create an function to make an entry for each photo returned by the multipe API calls
- function writeEntries($whatever){
- foreach ($whatever->photoset as $photos) {
- foreach ($photos->photo as $photo) {
- echo "<entry>";
- echo "<title>";
- echo htmlentities($photo["title"]);
- echo "</title>";
- echo "<link rel='enclosure' type='image/jpeg' href='http://farm{$photo["farm"]}.static.flickr.com/{$photo["server"]}/{$photo["id"]}_{$photo["secret"]}_b.jpg' />";
- echo "</entry> \n";
- };
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement