Writing a wordpress plugin and trying to include the Facebook PHP SDK

First of all download the zip of facebook php sdk from Facebook PHP SDK from Github.com

Extract the zip folder, you need only the ‘src’ folder for integrate your facebook application in your plugin.

copy the ‘src’ folder and paste it in your plugin directory.

In your plugin installer file, first start your session by writting session_start() and then include the facebook.php file from src folder.
Like this:

session_start();
include(‘src/facebook.php’);

Now follow the below code.

session_start();
include('src/facebook.php');

$config = array('appId' => 'Your APP ID', 'secret'=> 'Your App Secret');

$connect = new Facebook($config);

$user = $connect->getUser();
$me = null;

if($user)
{
    try
    {
         $me = $connect->api('/me');
    }
    catch(FacebookApiException $e)
    {
        echo $e->getMessage();
    }
}

if($me)
{
    $logoutUrl = $connect->getLogoutUrl();
    echo "Logout";
}
else
{
    //as the facebook php sdk version is 3 so there is some change for permissions
    // If you want to add permission for read_streams so that pass array with login url
    $params = array('scope'=>'read_stream');
    $loginUrl = $connect->getLoginUrl($params);
    echo "Login";
}

Now you can login with facebook and asks for permission for read stream for first time only.