I have a web page using php and facebook php sdk. When I test this web on localhost, it works fine. But when I try to run it on byethost server, the getUser() alway return 0. This's my code:
include_once "src/facebook.php";
$facebook = new Facebook(array(
'appId' => $appid,
'secret' => $appsecret
));
$user = $facebook->getUser();
if($user) {
try {
$me = $facebook->api('/me','GET');
$fname = $me['first_name'];
} catch(FacebookApiException $e) {
error_log($e);
}
} else {
$loginUrl = $facebook->getLoginUrl();
echo("<br>login url=".$loginUrl);
}
Please help me how to config this code to run on real server. Thanks.