<?php
#Bring the API call XMLs into the environment.
$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]");
$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]");
#Atom feed header
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 htmlentities($photoset_info->photoset->title);
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";
#Create an entry for each photo returned by the API
foreach ($photoset_photos->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";
};
}
echo "</feed>";
?>