How do I get information about a photo on flickr?
how to get information about a photo, for example the author, using PHP?
+1
ajushi
source
to share
3 answers
You make a REST HTTP request 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 any chunks of data you need, from any REST calls you need.
All of this is available via the flickr api
+4
Jeff winkworth
source
to share
This information is available through the Flickr API , if you scrape your docs you can find what you are looking for.
+3
Jeremy
source
to share
You need to use the public Flickr API . Sign up for an API key and then take a look at this page (which gives you a basic introduction to APIs and parsing serialized PHP. I prefer using XML with SimpleXML).
You may find it easier to use one of the following packages:
- PEAR
- phpFlickr
- phlickr (PHP5)
Please refer to the documentation for information on using them.
+3
Ross
source
to share