Support the ongoing development of Laravel.io →
posted 10 years ago
Packages

Hi

I'm trying to integrate facebook into a back end, enable the user to post to the companies facebook page from a CMS. I've looked at tutsplus tutorial and the facebook developer pages

I've found this package: https://github.com/thomaswelton/laravel-facebook

I've set it up and created an app in facebook, set up the details in config.

I'm now trying to access basic details such as 'getUser()' feeds using an api call but getting no where fast.

I tried using the facebook SDK direct and following the various turorials but still struggling to get any results. - I get zero or null returns for getUser or feeds.

Here's my code:

$facebook = new FB(array(
        'appId'=>Config::get('laravel-facebook::appId'),
        'secret'=>Config::get('laravel-facebook::secret'),
        'cookie'=>true
    ));

try {
        $fbUser = $facebook->getUser();

        $args = array('access_token' => $facebook->getAccessToken());
        $feeds = $facebook->api('/' . Config::get('laravel-facebook::pageId') . '/feed', 'GET', $args);

       
        dd($feeds);
    } catch (FacebookApiException $e) {
        echo 'Caught exception: ',  $e->getMessage(), "\n";
        exit;
    }

This is just test code. I don't know enough about facebook or the SDK yet. With the app credentials do I need to add a log in? I'm not getting oAuth errors - I tested and used duff data in the config which threw an authentication error.

Getting very confused - just don't know where to start

Any help appreciated

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.