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
https://forums.phpfreaks.com/topic/252341-how-can-i-know-the-facebook-user-id/
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...

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.