Share custom message, link and image on facebook via facebook sharer.php or using FB.api

牧云@^-^@ 提交于 2019-12-04 06:34:25

问题


I want to implement facebook sharing. I tried using the facebook sharer.php but it no more accepts custom parameters (deprecated by facebook). Also, I saw an option to use the FB.api to post on facebook.

I just want to know the correct syntax for doing this using FB.api where I can share some custom message, image and link. P.S. - The application that I am working on is Java based and pages are jsp pages.

Thanks in advance.


回答1:


Messages must be 100% user generated, prefilling is not allowed - if that is what you mean with "custom message". That being said, there is the FB.ui share dialog: https://developers.facebook.com/docs/sharing/reference/share-dialog

It works similar to sharer.php and only takes the URL as parameter. That´s the recommended way, you just need to add the correct Open Graph tags to the shared URL.

Another possible way to share something is to use the feed endpoint of the user object: https://developers.facebook.com/docs/graph-api/reference/v2.3/user/feed#publish

...but you need to authorize the user with publish_actions for that, and you have to go through a review process on Facebook before you can go public with that permission. Obviously, you will not get approved if you prefill the message parameter.

More information about sharing in general: https://developers.facebook.com/docs/sharing



来源:https://stackoverflow.com/questions/30523671/share-custom-message-link-and-image-on-facebook-via-facebook-sharer-php-or-usin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!