我正在Facebook页面上对我们的网站进行更新。这已经停止了一段时间。我将所有内容更新到最新的API并且能够发布,但仅作为从登录用户到页面的帖子,而不是作为页面管理员。我发现强制'default_graph_version'为'v2.2'使得事情按预期工作。我的问题:
我需要更改以使用最新的default_graph_version在页面上发布作为页面(因此不是具有管理员权限的用户)吗?
我不得不改变:
$fb = new Facebook\Facebook( [
"app_id" => "%appId%", //* this is the appId for amazingjokes
"app_secret" => "%appSecret%",
] );
到此:
$fb = new Facebook\Facebook( [
"app_id" => "%appId%", //* this is the appId for amazingjokes
"app_secret" => "%appSecret%",
"default_graph_version" => 'v2.2'
] );
使事情有效。我发布的内容如下:
$attachment = [
"message" => "test amazingjokes.com",
"name" => "amazingjokes test",
"caption" => "your daily laugh!",
"link" => "http://www.amazingjokes.com/",
"description" => "description test"
"picture" => "http://www.amazingjokes.com/img/2016/581750c9c7979_Merry....jpg"
];
try{
$result = $fb->post( "419661214806422/feed", $attachment, $accessToken );
} catch( Exception $e ){
die( "<pre>" . print_r( $e, true ) . "</pre>" );
}
它使用图形版本的v2.2,所以我确定我的权限是正确的('manage_pages'和'publish_pages')