doujiongqin0687 2011-06-26 14:12
浏览 67
已采纳

facebook-> getUser返回0

I have a Facebook fan page and I want to check if the user visiting the page LIKES the page in order to show the content. It works when I am logged in as the administrator but when another account visits the page the facebook->getUser() always return 0

require 'src/facebook.php';

$facebook = new Facebook(array(
  'appId' => 'ID',
  'secret' => 'HASH',
  'cookie' => true,
));

$user = $facebook->getUser();

//Page id

$page = '215010578537112';


$likeID = $facebook->api(array( 'method' => 'fql.query', 'query' =>
'SELECT uid  FROM page_fan WHERE uid =' . $user . 'AND page_id =' .$page ));

if ( $likeID ) {

}else{

}
  • 写回答

2条回答 默认 最新

  • drdyszuy488152 2011-06-26 16:50
    关注

    Since this is a fan page, you don't need to call an FQL query, since an FQL query requires that the user has first authorized your application. Facebook will send a signed_request post parameter to your iframe fan page. See this answer on how to decode that signed_request parameter and check to see if they are a fan of your page or not.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)