Jump to content

How can I know the Facebook user ID


eariass

Recommended Posts

How can I know the Facebook user ID when a user visit my fanpage before she/he click like button. I want to show "hello XXXXXXX" when enter to my landing tab.

 

This is my code but not show nothing...

 

 

$app_id = "xxxxxxxxxxxxxxxxxxxxx";

$app_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";

 

include_once 'facebook.php';

global $api_id,$app_secret;

$fb=new Facebook($api_id,$app_secret);

$fb_user=$fb->get_loggedin_user();

 

echo $fb_user;

?>

Link to comment
Share on other sites

Thank you Zephni,

 

this is my code:

 

$app_id = "xxxxxxxxxxxx";

$app_secret = "xxxxxxxxxxxxxxxxx";

 

include_once 'facebook.php';

global $api_id,$app_secret;

$facebook=new facebook($api_id,$app_secret);

 

$uid = $facebook->getUser();

 

echo $uid;

 

but this error are in error_log:

 

[02-Dec-2011 15:20:11] PHP Fatal error:  Call to a member function getUser() on a non-object in /home/mintcom/public_html/apps/arena/camara/hola.php on line 10

 

this is my link

http://mint.com.sv/apps/arena/camara/hola.php

 

I dont know what are doing wrong...

Link to comment
Share on other sites

require_once("facebook.php");

 

$config = array();

$config[‘appId’] = 'YOUR_APP_ID';

$config[‘secret’] = 'YOUR_APP_SECRET';

 

$facebook = new Facebook($config);

 

 

Try this for setting up the facebook object (Capital 'F'), not even sure if that will make any difference, I havent used the facebook API for a couple of months.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.