ajushi
ajushi

Reputation:

How to get photo info on flickr?

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

Upvotes: 1

Views: 2456

Answers (3)

Jeff Winkworth
Jeff Winkworth

Reputation: 4996

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

Upvotes: 4

Ross
Ross

Reputation: 46987

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.

Upvotes: 3

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

Upvotes: 3

Related Questions