English 中文(简体)
获取用户ID 绕过 Oauth2. 0 的facebook 应用程序
原标题:facebook app get userID bypass Oauth2.0

我想创建一个类似于这个页面的Facebook应用程序

https://www.facebook.com/carlolinosg/ap_150206515038121

如果用户用正确的用户ID 点击“类似”, 用户可以访问下面的内容, 用户点击时会像点击一样, 并检查页面 。

如果我没有弄错, 所有fb 应用程序都需要用户通过许可页面, 才能与应用程序互动 。

然而,此应用程序似乎允许用户单击类似内容, 并且通过 $facebook- gt; getUser () () (如果我没弄错) 获得用户ID 。 < strong > 无需通过许可页面

我在想我如何实现这个Facebook应用程序的设计?

UID为什么总是返回无效?

            <?php
            require_once("facebook.php");
            $config = array();
            $config[ appId ] =  xxx ;
            $config[ secret ] =  xxxx ;
            $config[ fileUpload ] = false; // optional

            $facebook = new Facebook($config);

                $fql =  SELECT  uid FROM user where uid = me() ;
                        $ret_obj = $facebook->api(array(
                             method  =>  fql.query ,
                             query  => $fql,
                                ));

                        var_dump($ret_obj );
            ?>
最佳回答

(1) 如果需要用户 ID 或用户信息或Facebook上的任何数据,则需要请用户授权应用程序。

2) 如果您不担心谁是浏览应用程序的用户,但您想看看用户是否喜欢你的页面,那么您可以在用户喜欢页面时使用此代码并显示内容。

<?php
 require  facebook/src/facebook.php ;
 $facebook = new Facebook(array(
   appId   => $CONF[ FB_APP_ID ],
   secret  => $CONF[ FB_APP_SECRET ],
   cookie  => false,
 ));

 // Get User ID
 $user = $facebook->getUser();
 $signed_request = $facebook->getSignedRequest();
 $like_status = $signed_request["page"]["liked"];
 if($like_status == 1){ 
 echo  You liked the page. so you are able to see this ;
 }else{  echo  Please like the page to access ; 
 } ?>

3) 如果您对用户查看应用程序的用户是谁并不感到困扰,而您不想让用户喜欢,请发送 html 页面 。

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签