cant initialize php facebook sdk -
i'm trying simple task. initialize facebook php sdk , return user id. i'm wondering if there problem require_once path have included access sdk, i'm not sure. echo message works, nothing else. have tried writing require_once path few different ways see if problem, nothing worked.
<?php echo "hello world"; require_once(dirname(__file__).'/php-sdk/facebook.php'); $application_id = '396***8'; $application_secret = '134559c****eb4f2da'; $config = array(); $config['appid'] = $application_id; $config['secret'] = $application_secret; $facebook = new facebook(config); $uid = $facebook->getuser(); echo $uid; ?>
assuming entire php code on page, working intended, getuser()
should return 0 there no logic authorizes user. need login handling logic user either js sdk or getloginurl()
function see example https://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php.
also check ensure running latest sdk (3.2.2) https://github.com/facebook/facebook-php-sdk/
Comments
Post a Comment