使用 graph api 私下发布到 Facebook 上的朋友墙
我想从我的应用程序将提要发布到朋友墙上,并将其设置为私有,登录用户和朋友都可以查看。 我想使用新的 Graph api 来做到这一点,我看到如果我在 feed 帖子中设置“to”参数,它将被发布到用户朋友墙上。
我在这里找到了一个代码: http://forum.developers.facebook.net/viewtopic.php? id=56458 (由VovaOnline发布) (链接已失效,因为 Facebook 已关闭该论坛)
$result = $facebook->api('/me/feed', 'POST', array(
'from' => array(
'name' => 'Vladimir Ageenko',
'id' => '100001308281502'
),
'name' => 'TEST NAME',
'caption' => 'Test Caption',
'description' => 'Test Description',
'message' => 'This is test.',
'privacy' => array(
'description' => 'Vladimir Sergeevich',
'value' => 'CUSTOM',
'friends' => 'SOME_FRIENDS',
'allow' => '100001338940933'
)
));
我将帖子类型设置为“链接”。 谁能告诉我这段代码有什么问题。我知道的一件事是“来自”字段必须是“到”,并且必须在“数据”变量中传递。我不知道该怎么做。 有人可以帮助我吗?
I wanted to post a feed to a friends wall from my app and set it as private, which is viewable to the logged in user and the friend.
I want to do this using the new Graph api, I saw that if I set the "to" parameter in the feed post, it will be posted to the users friend wall.
I found a code here:http://forum.developers.facebook.net/viewtopic.php?id=56458
(Posted by VovaOnline)
(link is dead, as facebook has taken down the forum)
$result = $facebook->api('/me/feed', 'POST', array(
'from' => array(
'name' => 'Vladimir Ageenko',
'id' => '100001308281502'
),
'name' => 'TEST NAME',
'caption' => 'Test Caption',
'description' => 'Test Description',
'message' => 'This is test.',
'privacy' => array(
'description' => 'Vladimir Sergeevich',
'value' => 'CUSTOM',
'friends' => 'SOME_FRIENDS',
'allow' => '100001338940933'
)
));
I am setting the post type as "link".
Can anyone tell me what is wrong in this code. One thing I know that "from" field has to be "to" and it has to be passed in a "data" variable. I am not sure how to do it.
Can any one help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须对隐私数组进行编码,请尝试以下操作:
You must encode privacy array, try this:
我认为 Facebook 目前不允许你这样做。查看关于发布的图形 API 文档:
http://developers.facebook.com/docs /reference/api/post/
它说关于隐私:
我对此的解释是,如果您在别人的墙(提要)上发帖,那么隐私就不受您的控制。
I don't think Facebook allows you to do this currently. Look at the graph API docs on Posting:
http://developers.facebook.com/docs/reference/api/post/
it says on privacy:
I interpret this to mean that if you post on someone else's wall (feed), privacy is out of your control.
从现在开始,由于 2013 年 2 月 6 日发生的重大更改,无法在用户的朋友墙上发帖:
https ://developers.facebook.com/roadmap/completed-changes/
From now on it's not possible to post on user's friend wall due to February 6, 2013 breaking changes:
https://developers.facebook.com/roadmap/completed-changes/