Okay, the code shown above is the exact contents of the zip file that was posted with the article, which is here:
http://www.phpbuilder.com/columns/adam_delves20060417.php3
Being short of time, I just inserted my flickr api key where indicated, and expected the code to work. It didn't.
On closer examination today, I realized that a value for $_GET['username'] was needed.
I also realized that much of the php in the html section was garbled. So I fixed it, as shown below. But still, the functions return only errors. As a php beginner, I don't think I can sort this out.
I have 2 questions:
1. Why was such garbled code posted with an article on this website?
2. Why is there such a scarcity of php api xml examples on the internet? I have not found anything useful yet. Can anyone provide links to something that actually works, and is really clear so a beginner can learn from it?
Thanks.
MY FIXED VERSION OF THE HTML SECTION:
<html>
<head>
<title>Flickr RPC Demo</title>
<style type="text/css">
#latestFlickr { border: 2px solid black; width: 130px; text-align: center; }
#latestFlickr h2 { text-align: center; font-weight: bold; font-family: sans-serif; font-size: 70%;}
#latestFlickr .flickrPhoto { margin-left: auto; margin-right: auto;}
.flickrPhoto img {margin-bottom: 3px; border:0px;}
</style>
</head>
<body>
<div id="latestFlickr">
<h2>Latest Flickr Photos</h2>
<script language="php">
if ($error !== false){
print "<div class='error'>htmlspecialchars{$error}</div>";
}
foreach($photos as $photo) / travese the photo list and construct a link and image URL for each /
{
print "<div class='flickrPhoto'>
<a href='http://www.flickr.com/photos/{$user_id}/{$photo['id']}/>
<img src='http://static.flickr.com/{$photo['server']}/{$photo['id']}{$photo['secret']}s.jpg')/></a></div>";
}
</script>
</div>
</body>
</html>