I would like to create a Facebook app similar to this page
https://www.facebook.com/carlorinosg/app_150206515038121
user clicks like and the page checks if the user has click “like” with the correct userID ,it will allow user to access the content below.
If i am not mistaken, all fb apps require user to go through the permission page before user can interact with the application.
However this app seems to allow user to click the like and it gets the userID via $facebook->getUser(); ( if i am not mistaken) without going through the permission page..
i was wondering how do I achieve the same design as this facebook app ?
why does UID always return null. ? the code below
<?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) If you need user id or user info or any kind of data from facebook, then you need to ask user to authorize the app.
2) If you are not bothered about who is the user viewing the app but you want to see whether user has liked your page, then you can use this code and show the content when user likes the page.
3) If you are not bothered about the who is the user viewing the app and you dont want user to like, send out the html page.