0

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.

Code Lღver
  • 15,573
  • 16
  • 56
  • 75
Muichirou
  • 51
  • 3
  • 2
    Make sure you have changed the app domain and URL to production URL in developers.facebook back end – Abdul Rehman Apr 23 '15 at 10:35
  • Making sure your Facebook Application Settings is correctly configured (as BSienn suggested) is the first step to debug this issue. Doing a quick search shows a lot of people who have reported this very same question before. Here's one that should be good http://stackoverflow.com/questions/8671079/facebook-getuser-returns-0 – curveorzos Apr 30 '15 at 01:37

0 Answers0