S
S
Shenku2016-11-02 01:09:07
Facebook
Shenku, 2016-11-02 01:09:07

How do I autopost to Facebook on behalf of a Group?

$linkData = [
    'link' => 'http://www.yandex.ru',
    'message' => 'User provided message',
];

try {
    // Returns a `Facebook\FacebookResponse` object
    $response = $fb->post('/293458671047285/feed', $linkData, $_SESSION['fb_access_token']);
} 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;
}

The post passes, but how is the publication of the visitor, who can come across?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2016-11-02
@zoonman

You can't post on behalf of a group, you can't even do it through Facebook.
You do not confuse the case with the page?
In order to post to a Facebook page, you need to get a list of accounts.
You make a GET /me/accounts call, each will have its own token in the results.
Switch to the desired token through the setDefaultAccessToken() method, and POST /me/feed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question