使用Facebook PHP SDK更改帖子隐私时出错

时间:2015-10-15 11:29:31

标签: php facebook-php-sdk

我正在做的是使用Facebook PHP SDK(v4)创建帖子(并且应用程序设置为使用v2.3 API),并将隐私设置值设置为SELF,然后更改值为CUSTOM,并允许已接受该应用的朋友的ID。

直到最近,一切都运行良好,现在突然之间我得到了这个错误(我们没有改变):"(#100)对象不支持消息编辑",我无法找到他们的文档。有没有人遇到过这种情况和这个错误?

以下是我使用的代码(就像我说的一切工作到最近一样)(如果您需要更多详细信息,请告诉我们)

        $fb_token = 'FB_TOKEN';

        $FB_session = new FacebookSession($fb_token);
        try {
          $FB_session->validate();
        } catch (FacebookRequestException $ex) {
          // Session not valid, Graph API returned an exception with the reason.
          //echo $ex->getMessage();
          throw new RestException(501,'FB error: '. $ex->getMessage());
        } catch (\Exception $ex) {
          // Graph API returned info, but it may mismatch the current app or have expired.
          //echo $ex->getMessage();
          throw new RestException(501,'FB error: '. $ex->getMessage());
        }

        //make posting request to FB
        if($FB_session) {
          try {
            $fb_array = array(
                'privacy' => array(
                                'value' => 'CUSTOM',
                                'allow' => 'USER_ID'
                                )
              );

            $fb_req = new FacebookRequest(              
              $FB_session, 'POST', "/POST_ID", $fb_array
            );
            $response = $fb_req->execute()->getGraphObject();
            //echo "Posted with id: " . $response->getProperty('id');
            $fb_post_id = $response->getProperty('id');             

          } catch(FacebookRequestException $e) {
            //echo "Exception occured, code: " . $e->getCode();
            //echo " with message: " . $e->getMessage();
            throw new RestException(501,'FB error: '. $e->getCode() .'-'. $e->getMessage());
          }   
        }

0 个答案:

没有答案