简体   繁体   English

Facebook PHP SDK 5.0-发布到组

[英]Facebook PHP SDK 5.0 - Posting to group

I have been stumped for a while now. 我已经被困了一段时间了。 I'm attempting to write myself a small app to automatically post to a number of groups that I am members of in FB. 我正在尝试为自己编写一个小应用程序,以自动发布到FB成员中的多个组。 I'm a PHP novice, but this is about my strongest skill set for what FB allows in terms of access that I can tell. 我是PHP的新手,但这是我在FB允许的访问能力方面最强的技能。 So far, I CAN post to my own wall no problem but once I try and post to my own FB testing group I'm stumped. 到目前为止,我可以毫无问题地张贴到自己的墙上,但是一旦我尝试将其张贴到自己的FB测试小组,我就感到很困惑。 Here is my code so far... 到目前为止,这是我的代码...

<?php
require_once __DIR__ . '/vendor/autoload.php';    
require 'src/config.php';
require 'src/facebook.php';

$fb = new Facebook\Facebook([
  'app_id' => $config['App_ID'],
  'app_secret' => $config['App_Secret'],
  'default_graph_version' => 'v2.8',
  ]);

$linkData = [
  'link' => 'http://www.example.com',
  'message' => 'Test post to my feed.',
  ];

try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post('/{group_id}/feed', $linkData, $config['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;
}
?>

Currently the error that this is generating is: Graph returned an error: (#200) Insufficient permission to post to target on behalf of the viewer 当前,它生成的错误是:图形返回错误:(#200)权限不足,无法代表查看者发布到目标

I have made the app Public and generated the access token with manage_pages and publish_pages. 我已将应用程序设为“公开”,并使用manage_pages和publish_pages生成了访问令牌。 Unfortunately I'm out of ideas as of this point. 不幸的是,到目前为止我还没有想法。 Any help would be greatly appreciated. 任何帮助将不胜感激。 Thanks in advance. 提前致谢。

OK. 好。 I figured out my problem at this point. 我现在已经解决了我的问题。 It was that I had to go into the App Settings in my FB user account and change my App from "Only Me" to Public. 那是我必须在FB用户帐户中进入“应用程序设置”,然后将我的应用程序从“仅我”更改为“公开”。 Once I did that I was able to post to my groups. 完成后,我就可以发布到我的论坛了。 Next will be to figure out how to post into the proper fields for a "Sell Something" type of post and then to test it in groups that I'm not an admin of. 接下来将要弄清楚如何在“ Sell Something”类型的帖子中发布适当的字段,然后在我不是管理员的组中对其进行测试。

I figure it has to be possible to post into non-admin groups since there are a number of services out there for FB auto-posting and they have to get around it somehow. 我认为必须发布到非管理员组中,因为那里有许多服务可以自动发布FB,并且它们必须以某种方式解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM