1. Go to this page and download the library: Download grippo/fb-php-server-login library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
grippo / fb-php-server-login example snippets
if(!session_id()) {
session_start();
}
if (array_key_exists('facebook_access_token', $_SESSION) && isset($_SESSION['facebook_access_token']))
{
// user is logged in
} else {
$config = parse_ini_file('../.config.ini', true);
$login = new Login(
$config['facebook']['app_id'],
$config['facebook']['app_secret'],
$config['facebook']['callback_url'],
$config['facebook']['permissions']
);
$url = $login->getLoginUrl();
// redirect to $url to login
}