A
A
Alexander Ampleev2018-06-20 17:53:49
PHP
Alexander Ampleev, 2018-06-20 17:53:49

How can I post to a group wall using the Facebook API?

How can I post to a group wall using the Facebook API? - I did everything on this question and the answer from vista1x, but the post is still not published automatically ..

public function post()
    {
        $fb = new Facebook(array(
            'app_id' => $this->app_id,
            'app_secret' => $this->app_secret,
            'default_graph_version' => 'v2.2',
        ));
        $fb->setDefaultAccessToken($this->access_token);

        $data = [
            'message' => $this->message,
            'source' => $fb->fileToUpload([путь до картинки]),
        ];

        $batch = [
            'photo' => $fb->request('POST', "/{$this->page_id}/photos", $data),
        ];

        $responses = $fb->sendBatchRequest($batch);
        return $responses;

    }

I tried both publishing the application and removing it from publication so that at least the admins can see the post ... in both cases, fail ..
this is what it gives if the application is not published
["responses":protected]=>
  array(1) {
    ["photo"]=>
    object(Facebook\FacebookResponse)#153 (6) {
      ["httpStatusCode":protected]=>
      int(403)
      ["headers":protected]=>
      array(11) {
        ["WWW-Authenticate"]=>
        string(73) "OAuth "Facebook Platform" "insufficient_scope" "(#200) Permissions error""

if you publish the application, it gives the following response:
array(1) {
    ["photo"]=>
    object(Facebook\FacebookResponse)#153 (6) {
      ["httpStatusCode":protected]=>
      int(403)
      ["headers":protected]=>
      array(11) {
        ["WWW-Authenticate"]=>
        string(156) "OAuth "Facebook Platform" "insufficient_scope" "(#200) This endpoint is deprecated since the required permissions manage_pages,publish_pages are deprecated""
        ["Expires"]=>

While I come to the conclusion that you need to send the application for verification in FB, am I thinking right? Or does it work for everyone without it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai, 2018-06-29
@itservice

it stopped working for me too

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question