问题描述
我似乎找不到答案。可能我的Google-fu让我失望。有没有办法使用FB的Graph API(或任何其他方式),以便分享一个页面的帖子在认证的用户的墙上,以便增加附件照片中显示的共享号码。
否和可能取决于您要如何完成此任务。
您希望它是一个完全依赖于代码的程序化自动共享机制,不需要用户主动共享? >
如果是这样,答案是否定的。实际上也可能违反平台政策,但不可能。
您是否介意是否是基于对话框的共享,对于不同类型的页面帖子具有不一致的行为?
如果是这样,你会幸运的。有些。当Facebook仍然支持时,有一个名为sharer.php的现在已经被弃用的函数,以前用于共享按钮。虽然这已经被弃用了,但是这是不太可能被删除的,但不幸的是它确实意味着没有文档。幸运的是,这很简单:
http://www.facebook.com/sharer.php?u=https://www .facebook.com / coca-cola / posts / 10152033676358306
以上是在可口可乐Facebook页面上分享一篇文章的示例。当然,您需要对 u
参数进行URL编码。您可以将其作为一个简单的链接,或者您可以使用Javascript将其附加到按钮的单击。但是,这里有一些注意事项:
- 这似乎只适用于不是自己分享帖子的帖子,比如你发布了一个截图。
- 我没有完整的 使用的类型的完整列表,但是状态更新完全可以正常工作。
如果你想追求这条路线,这里是我的建议:
- 使用Graph API Page对象,拉入/ posts连接
- 过滤到
的所有内容类型:status
- 要构建此链接以与sharer.php一起使用,请解析每个帖子ID为$ code> 12345678_987654321 进入
https://www.facebook.com/12345678/posts/987654321
或从每个帖子的/ actions / link字段(将有一个用于评论和一个喜欢,但他们将是一样的) - URLEncode这个,并使用它与sharer.php如上
- 对于页面帖子是的
类型:link
,获取链接
字段,只需使用sharer.php如上。这不会随意增加共享数,但会正确地重新共享链接。
希望其中一些可以帮助您,最终对您而言最适合的答案可能是否。
I can't seem to find an answer for this. Probably my Google-fu is letting me down.
Is there a way to use FB's Graph API (or any other way), in order to "share" a page's post on an authenticated user's wall so that it will increment the "share number" as show in the attached photo?
Okay, my answer varies between "no" and "maybe" depending on how exactly you want to accomplish this.
Do you want it to be a programmatic, automated sharing mechanism entirely dependant on code, that doesn't require the User to actively share it?
If so, the answer is no. Actually it would also probably violate Platform Policy too, but it isn't possible.
Do you mind if it is a dialog-based share, that has inconsistent behaviour for different types of Page posts?
If so, you are in luck. Somewhat. There is a now-deprecated function called "sharer.php" which used to be used for the Share Button, when Facebook still supported that. Though this has been deprecated, it is very unlikely to be removed, but unfortunately it does mean there is no documentation around. Luckily though, it is really simple:
http://www.facebook.com/sharer.php?u=https://www.facebook.com/coca-cola/posts/10152033676358306
The above is an example of sharing a Post on the Coca Cola Facebook Page. You would want to URL encode the u
parameter, of course. You could have this as a plain link, or you could attach it with Javascript to the onclick of a button. However, here come the caveats:
- This only seems to work with posts that are not themselves 'share' posts, such as the one you posted a screenshot of.
- I don't have a full list of the types that it does work with, but Status Updates work perfectly.
If you want to pursue this route anyway, here are my recommendations:
- Using the Graph API Page object, pull in the /posts connection
- Filter down to everything that is of
type: status
- To construct the link to this to use with sharer.php, either parse each Post ID of the type
12345678_987654321
intohttps://www.facebook.com/12345678/posts/987654321
or take the /actions/link field from each Post (there will be one for Comment and one for Like but they'll be both the same) - URLEncode this and use it with sharer.php as above
- For Page Posts that are of
type: link
, grab thelink
field and just use that with sharer.php as above. This won't increment the Share count as you want, but it will properly re-share the link.
Hope some of this helps you, ultimately the answer that works best for you maybe the 'no'.
这篇关于Facebook API:“分享”一个帖子已经贴在页面的墙上了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!