Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Facebook SDK v5 Posting from Website

  • 01-09-2015 09:23AM
    #1
    Registered Users, Registered Users 2 Posts: 1,991 ✭✭✭


    I have the below snippet and it works and posts to a Facebook page as my own user account on Facebook.
    // SDK Version 5.0
    $fb = new Facebook\Facebook([
    	'app_id' => FACEBOOK_APP_ID,
    	'app_secret' => FACEBOOK_APP_SECRET,
    	'default_graph_version' => 'v2.4',
    ]);
    
    // Returns a `Facebook\FacebookResponse` object
    $response = $fb->post('/'.FACEBOOK_PAGE_ID.'/feed', $postData, FACEBOOK_ACCESS_TOKEN);
    
    $postId = $response->getGraphNode();
    

    Now my question is how can I get it to post as the actual page and not my account which is the admin of the page.

    I've had a look at the SDK documentation and I've been going around in circles, there are many examples of V4 but as it's deprecated I'm trying to use V5 and just can't seem to figure it out, any links to post attribution or impersonation I find are dead links in V5 of the SDK.

    Any help greatly appreciated! :confused:


Advertisement