tags:

views:

399

answers:

3

Hi, how do I get information about a photo like the author, the license using PHP?

+3  A: 

This information is all available through the Flickr API, if you poke around their docs you may find what you're looking for.

Jeremy Banks
how do I use the Flickr API with php?
+2  A: 

You need to use Flickr's publically avaliable API. Sign up for an API key then have a look at this page (which gives you a basic introduction to contacting the API and parsing serialized PHP. Personally I prefer using XML with SimpleXML).

You may find it easier to use one of the following packages:

Consult the documentation for info on using them.

Ross
+2  A: 

You call a HTTP REST query, and load the results as a string:

$query = "http://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=" . API_KEY . "&photo_id=" . $photoid . "&format=json&nojsoncallback=1";
data = json_decode(file_get_contents($query));

echo "created by: " . data->photo->owner->username;
echo "link to photopage: " . "http://www.flickr.com/photos/" . data->photo->owner->nsid; . "/" . data->photo->id;

You do this for whatever pieces of data you need from whichever REST calls you require.

All of this is available via the flickr api

Jeff Winkworth