简体   繁体   English

通过Facebook PHP SDK版本4.0.9,Graph API v2.0分享帖子

[英]Share post via facebook php sdk version 4.0.9, Graph API v2.0

Using facebook php sdk version 4.0.9 & Graph API v2.0 使用Facebook PHP SDK版本4.0.9和Graph API v2.0

Here is my application settings for publishing post. 这是我发布帖子的应用程序设置。 在此处输入图片说明

My code is : 我的代码是:

$requestjojo = new FacebookRequest($session, 'POST', '/me/feed', array('message' => 'testing'));
$responsejojo = $requestjojo->execute();

// get response
$graphObjectjojo = $responsejojo->getGraphObject()->asArray();

// print Graph data
echo '<pre>' . print_r( $graphObjectjojo, 1 ) . '</pre>';

This is not working for me, I want to know where's the bug. 这对我不起作用,我想知道错误在哪里。

Note : I am getting user data(user profile) properly from this sdk. 注意:我正在从此SDK中正确获取用户数据(用户个人资料)。

Using echo '<a href="' . $helper->getLoginUrl(array('publish_stream')).'" target="_top">Login</a>'; 使用echo '<a href="' . $helper->getLoginUrl(array('publish_stream')).'" target="_top">Login</a>';

for login button, when login with Facebook, Facebook is not asking me for this extended permission(publish_stream) too. 对于登录按钮,当使用Facebook登录时,Facebook也不要求我提供此扩展许可权(publish_stream)。

The loginUrl is not build up properly. loginUrl没有正确建立。

 $helper->getLoginUrl(array(
    'scope' => 'publish_stream',
    'redirect_uri' => $your_redirect_uri
 ));

Finally, got the answer. 最后,得到答案。

The reason is that "publish_stream" is now deprecated; use "publish_actions" instead.

From : 来自:

Error (#200) The user hasn't authorized the application to perform this action 错误(#200)用户未授权应用程序执行此操作

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

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