本文介绍了FQL-我可以把我本周的朋友的照片发布吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试获取朋友的照片.上周至今发布
I try to get my friend's photos. posted last week till now
我如何使用FQL获得此信息?
how i can get this using FQL ?
推荐答案
您将需要提示friends_photos扩展权限. FQL查询将类似于:
You would need to prompt for the friends_photos extended permission. The FQL query would be something like:
SELECT pid, caption, aid, owner, link, src_big, src_small, created, modified FROM photo WHERE aid IN
(SELECT aid FROM album WHERE owner IN
(SELECT uid2 FROM friend WHERE uid1=me())
)
AND created > One_week_ago_in_unix_time ORDER BY created DESC
这是一个完整的例子:
<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
<a href="#" onclick="getPhotos();return false;">Get Photos</a>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({ appId: 'yourAppID', status: true, cookie: true, xfbml : true });
function getPhotos() {
FB.login(function(response) {
if (response.session && response.perms) {
var oneWeekAgo = Math.round((new Date().setDate(new Date().getDate()-7)) / 1000);
FB.api(
{
method: 'fql.query',
query: 'SELECT pid, caption, aid, owner, link, src_big, src_small, created, modified FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner IN (SELECT uid2 FROM friend WHERE uid1=me())) AND created > ' + oneWeekAgo + ' ORDER BY created DESC LIMIT 20'
},
function(response) {
alert('Photos: ' + JSON.stringify(response));
}
);
}
} , {perms:'friends_photos'});
}
</script>
</body>
</html>
这篇关于FQL-我可以把我本周的朋友的照片发布吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!