Using Login with Facebook in PHP

1

I'm trying to sign in with facebook, using SDK 3.2.3. I'm almost done, but the following message appears on the screen:

"Warning The parameter app_id is required".

Here is my code:

   <?php
require_once ("facebook.php");

$config = array(
        'app_id' => 'yyyyyyyyyyyyy',
        'secret' => 'xxxxxxxxxxxxx',
        'allowSignedRequest' =>  false,
);

$facebook = new Facebook($config);
$uid = $facebook->getUser();

$params = array(
  'scope' => 'public_profile, user_friends, email',
  'redirect_uri' => 'https://www.petsmatch.com.br'
);

$loginUrl = $facebook->getLoginUrl($params);

if($user_id) {

      try {

        $user_profile = $facebook->api('/me','GET');
        echo "Name: " . $user_profile['name'];

      } catch(FacebookApiException $e) {
        $login_url = $facebook->getLoginUrl(); 
        echo 'Please <a href="' . $login_url . '">login.</a>';
        error_log($e->getType());
        error_log($e->getMessage());
      }   
    } else {
      $login_url = $facebook->getLoginUrl();
      echo 'Please <a href="' . $login_url . '">login.</a>';

    }
    
asked by anonymous 06.07.2015 / 21:58

0 answers