Returning user data using facebook php sdk -
i'm trying figure out basics of facebook php sdk. i'm using pretty simple code below...
<?php include 'facebook.php'; $app_id = "my_id"; $app_secret = "my_secret"; $facebook = new facebook(array( 'appid' => $app_id, 'secret' => $app_secret, )); $userid = $facebook->getuser(); echo $userid; $userinfo = $facebook->api("/$userid"); echo $userinfo['name']; ?>
when ask $userid
$userid = $facebook->getuser(); echo $userid;
i correct value. when try take next step , retrieve logged in user's name :
$userinfo = $facebook->api("/$userid"); echo $userinfo['name'];
nothing returned. see error? thanks!
'/$userid'
use literal string /$userid
. want "/$userid"
or '/me'
Comments
Post a Comment