Facebook FQL / Graph - 获取所有当前的戳 [英] Facebook FQL / Graph - Get all current pokes

查看:94
本文介绍了Facebook FQL / Graph - 获取所有当前的戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



正常他们必须在表格通知...我感到困惑。 p>

希望有人可以帮助我。

解决方案

这是一个工作示例提示read_mailbox权限,并使用/ me / pokes检索用户戳。这可以使用相同的逻辑在任何服务器端语言中完成。



获取Pokes

 <!DOCTYPE html> 
< html>
< body>
< div id =fb-root>< / div>
< a href =#onclick =getPokes(); return false;> Get Pokes< / a>
< script src =http://connect.facebook.net/en_US/all.js>< / script>
< script>
FB.init({appId:'** yourAppID',status:true,cookie:true,xfbml:true});

函数getPokes(){
FB.login(function(response){
if(response.session&& response.perms){
FB。 api('/ me / pokes',function(response){
for(var i = 0; i< response.data.length; i ++){
alert(response.data [i] from.name +poked you。);
}
}
);
}
},{perms:'read_mailbox'});
}
< / script>
< / body>
< / html>

回拨:
要将用户重新插入,将发布HTTP Post to / userid / pokes,但是您需要通过Facebook获得白名单。否则你会得到这个回应:

  {
error:{
type:OAuthException,
消息:(#3)应用程序无法进行此API调用。,
}
}


How can I get my current pokes (and pokes back)?

Normaly they must be in the table "notification" ... I am confused.

Hope someone can help me.

解决方案

Here is a working example that prompts for read_mailbox permission and uses /me/pokes to retrieve a users pokes. This can be done in any server side language too using the same logic.

Get Pokes:

<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
<a href="#" onclick="getPokes();return false;">Get Pokes</a>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({ appId  : '**yourAppID', status : true, cookie : true, xfbml  : true });

  function getPokes() {  
    FB.login(function(response) {
      if (response.session && response.perms) {
        FB.api('/me/pokes',  function(response) {
            for(var i=0; i < response.data.length; i++) {
              alert(response.data[i].from.name + " poked you.");
            }
          }
        );
      }
    } , {perms:'read_mailbox'}); 
}
</script>
</body>
</html>

Poke back: To poke a user back, you would issue an HTTP Post to /userid/pokes but you need to get whitelisted by Facebook. Otherwise you will get this response:

{
  error: {
    type: "OAuthException",
    message: "(#3) Application does not have the capability to make this API call.",
  }
}

这篇关于Facebook FQL / Graph - 获取所有当前的戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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