简体   繁体   中英

How to get photo info on flickr?

如何使用PHP获得有关照片的信息,例如作者,许可证?

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

所有信息都可以通过Flickr API获得 ,如果您戳他们的文档,您可能会找到想要的东西。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM