1
votes

I've downloaded the Facebook SDK for PHP v5.0.0 several times from Github and via Composer. It does not have a file FacebookSession.php or a class FacebookSession at all, anywhere. I've searched for the file and the class in the download. I'm simply trying to do this:

    $request = new Facebook\FacebookRequest(
        $session,
        'GET',
        '/me/photos',
        array(
            'type' => 'uploads'
        )
    );

    $response = $request->execute();
    $graphObject = $response->getGraphObject();

I have the access token, but it says I need to provide the Facebook session where the $session variable is. I don't know how I'm supposed to get it without that class that I've seen in many examples. E.G.

use Facebook\FacebookSession.

I downloaded it from here: https://github.com/facebook/facebook-php-sdk-v4 I ran:

composer require facebook/php-sdk-v4

To get it from Composer.

1

1 Answers

0
votes

I'm using the following code instead of the code above:

    try {

        // Returns a `Facebook\FacebookResponse` object
        $response = $this->fb->get('/me/photos?type=uploaded', $this->accessToken);

    } catch(Facebook\Exceptions\FacebookResponseException $e) {

        echo 'Graph returned an error: ' . $e->getMessage();
        // exit;

    } catch(Facebook\Exceptions\FacebookSDKException $e) {
        echo 'Facebook SDK returned an error: ' . $e->getMessage();
        // exit;

    }

    $photos = $response->getGraphEdge();

It works.