如何网站与Flickr API进行整合 [英] How to integrate website with Flickr Api

查看:143
本文介绍了如何网站与Flickr API进行整合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想整合自己的网站与Flickr API。我已经生成组oauth_token和oauth_token_secret但我不`吨知道下一步,如何使用它们获取用户的照片是什么。

Thx提前

我使用 http://sourceforge.net/projects/phlickr/ 类工作它:

  $ Flickr的=新的Flickr($这个 - > FLICKR_CONSUMER_KEY,$这个 - > FLICKR_CONSUMER_SECRET);
$ flickr->身份验证('读');$组oauth_token = $ flickr-> getOauthData(Flickr的:: OAUTH_REQUEST_TOKEN);
$ oauth_token_secret = $ flickr-> getOauthData(Flickr的:: OAUTH_REQUEST_TOKEN_SECRET);


解决方案

  

我使用 http://sourceforge.net/projects/phlickr/ 类工作它:


我不认为你是。从我可以告诉,Phlickr不再被积极开发,不支持OAuth的。此外它的用途是不一样的code告诉你。

基于微小code片断,提供

,我想你实际上是用我的 DPZFlickr 库。

如果是这样的话,那么你会发现在示例目录已经做了你在找什么样的一些code。从本质上讲,你需要做的是这样的:

  $ Flickr的=新的Flickr($这个 - > FLICKR_CONSUMER_KEY,$这个 - > FLICKR_CONSUMER_SECRET);
$ flickr->身份验证('读');
$参数=阵列(
    'USER_ID => 50317659 @​​ N00',//与用户的NSID替换你有兴趣
    per_page'=> 100,
    '附加'=> url_sq,path_alias',
    );$响应= $ flickr->调用('flickr.photos.search',$参数);
$照片= $回应['照片'];

$照片随后将包含照片的数组。同样,这些例子会告诉你code,从它需要的数据,并生成HTML。

I would like to integrate my website with Flickr API. I have already generate oauth_token and oauth_token_secret but I don`t know what to do next, how to use them for getting user photos.

Thx in advance

I am using http://sourceforge.net/projects/phlickr/ class to work with it:

$flickr = new Flickr($this->FLICKR_CONSUMER_KEY, $this->FLICKR_CONSUMER_SECRET);
$flickr->authenticate('read');

$oauth_token = $flickr->getOauthData(Flickr::OAUTH_REQUEST_TOKEN);
$oauth_token_secret = $flickr->getOauthData(Flickr::OAUTH_REQUEST_TOKEN_SECRET);

解决方案

I am using http://sourceforge.net/projects/phlickr/ class to work with it:

I don't think you are. From what I can tell, Phlickr is no longer being actively developed and doesn't support OAuth. Also it's use is nothing like the code you show.

Based on the tiny code snippet you provide, I think you are actually using my DPZFlickr library.

If that is the case, then you should find some sample code in the examples directory that does what you are looking for. Essentially, you need to do something like this:

$flickr = new Flickr($this->FLICKR_CONSUMER_KEY, $this->FLICKR_CONSUMER_SECRET);
$flickr->authenticate('read');
$parameters =  array(
    'user_id' => '50317659@N00',  // Replace with the NSID of the user you are interested in
    'per_page' => 100,
    'extras' => 'url_sq,path_alias',
    );

$response = $flickr->call('flickr.photos.search', $parameters);
$photos = $response['photos'];

$photos will then contain an array of photos. Again, the examples will show you code that takes that data and generates HTML from it.

这篇关于如何网站与Flickr API进行整合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆