检查Facebook用户是否喜欢使用fql的页面 [英] Check if a Facebook user likes a page using fql

查看:127
本文介绍了检查Facebook用户是否喜欢使用fql的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查loggedIn用户是否喜欢指定的页面。以下是我的代码。

I want to check whether the loggedIn user has liked a specified page or not. Below is my code.

$fql_pageid = "SELECT url,site,id FROM object_url WHERE url    
                     IN('http://developers.facebook.com/')";
$api_pageid = $facebook->api(array(
                    'method' => 'fql.query',
                    'query' => $fql_pageid
));
$pageid = $api_pageid[0]["id"]; //get id of the specified page
$fql_like = 'SELECT object_id FROM like WHERE user_id=me()';
$api_like = $facebook->api(array(
                    'method' => 'fql.query',
                    'query' => $fql_like
));

当我做 var_dump($ api_like) ,只有6条记录出现。但是我检查了我的Facebook帐户,有22个喜欢。

When I do var_dump($api_like), there are only 6 records appearing. But I checked my Facebook account, there are 22 likes.

任何人都知道上述代码有什么问题?或者还有其他方式来检查用户是否喜欢指定的页面?

Anyone knows what's wrong the above code? Or is there any other way to check whether a user has liked a specified page?

推荐答案

当前用户( uid = me())是Big Bang Theory页面的Fan,页面为* page_id = 22934684677 *(http://graph.facebook.com/TheBigBangTheory),您应该运行此查询:

Let's say that you want to check if the current user (uid=me()) is Fan of the "Big Bang Theory" page with *page_id=22934684677* (http://graph.facebook.com/TheBigBangTheory) you should run this query:

SELECT page_id FROM page_fan WHERE uid=me() AND page_id=22934684677

这篇关于检查Facebook用户是否喜欢使用fql的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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