为什么发布到Facebook组的VIA图形API始终被视为垃圾邮件?

时间:2019-04-11 18:02:45

标签: php facebook api facebook-graph-api access-token

我正在使用此代码以页面形式发布到我自己的facebook组。 该邮件已成功发布,但该帖子始终被阻止为垃圾邮件。 当我正常地从Facebook群组页面发布到Facebook群组时,它没有问题。 我想念什么?

$long_lived_user_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

                $page_long_access_token= '';

                //get page access token
                $useraccountsobj = json_decode(file_get_contents('https://graph.facebook.com/v3.2/0000000000000000000/accounts?access_token='.$long_lived_user_access_token))->data;
                foreach($useraccountsobj as $page)
                {
                    if($page->id == '1111111111111111111111')
                    {
                        $page_long_access_token= $page->access_token;
                    }
                }


                // creating facebook object for ishyqa app
                $fb = new \Facebook\Facebook([
                    'app_id' => '555555555555555555555',
                    'app_secret' => 'yyyyyyyyyyyyyyyyyyyyyyy',
                    'default_graph_version' => 'v3.2',
                    'default_access_token' => 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii', 
                ]);


                $post_msg = $question->title . '

                ' . $question->details;

                //make post to page
                try {
                    // Returns a `Facebook\FacebookResponse` object
                    $response = $fb->post(
                        '/999999999999999999999/feed',
                        array (
                            'message' => $post_msg
                        ),
                        $long_lived_user_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;
                }
                $graphNode = $response->getDecodedBody();


                return $graphNode['id']; 

0 个答案:

没有答案