ckeck如果用户喜欢Facebook页面或没有请求访问令牌 [英] ckeck if user like Facebook page or not without request Access Token

查看:90
本文介绍了ckeck如果用户喜欢Facebook页面或没有请求访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 window.fbAsyncInit = function() {
        FB.init({
          appId      : '********', // App ID
          channelUrl : document.location.protocol + '//connect.facebook.net/en_US/all.js', // Channel File
          status     : true, // check login status
          cookie     : true, // enable cookies to allow the server to access the session
          xfbml      : true  // parse XFBML
        });


 var fql_query = "SELECT uid FROM page_fan WHERE page_id = "+page_id+"and uid="+user_id;
            FB.Data.query(fql_query).wait(function(rows) {
              if (rows.length == 1 && rows[0].uid == user_id) {
                console.log("LIKE");
                $('#container_like').show();
              } else {
                console.log("NO LIKEY");
                $('#container_notlike').show();
              }             }

只是我需要检查用户喜欢Facebook页面或没有请求任何访问令牌或权限是可能的???

just i need to check user like Facebook page or not with out request any access token or permission is that possible ???

推荐答案

是的,我可能通过php做了以下代码,没有来自用户的请求和许可

yes , i possible i did that by php with following code with out request and permission from user

        require 'src/facebook.php';
// Create our Application instance (replace this with your appId and secret).
        $facebook = new Facebook( array(
            'appId' => '***************',
            'secret' => '**********************',
            'cookie' => true,
                ) );
        $signed_request = $facebook->getSignedRequest();
// Return you the Page like status
        $like_status = $signed_request[ "page" ][ "liked" ];

        if ( $like_status ) {?>
            <div class="facebook-data-content" id="facebook-data-content"> </div>

        <?php } else {
            ?>
            <div class="like-gate" id="like-gate"> </div>
        <?php } ?>

您可以使用JavaScript
注意:所有需要检查重定向网址是否正确先做任何事情,因为关于这个问题的大多数问题

and you can do the same with JavaScript note : all need check that redirect URL correct first before do anything because most problem about this issues

祝你好运:)

这篇关于ckeck如果用户喜欢Facebook页面或没有请求访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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