I am trying to retrieve information through Facebook graph api, using the below code which is returning me nothing, I wrote this code after getting help from on line documentations etc. but it's not working.
Kindly help me with this.
include ('src/facebook.php');
$app_id = "160336957418730";
$app_secret = "************************";
$facebook = new Facebook( array('appId' => $app_id, 'secret' => $app_secret, ));
$user = $facebook -> getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook -> api('/me');
//$user_profile = $facebook->api('/me/home');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
echo $user_profile[name];
echo $user_profile[id];
echo $user_profile[picture];
I treid them all but nothing is working.