Question

I know it is possible to share a content on Facebook using a URL format like this:

https://www.facebook.com/dialog/feed?%20app_id=145634995501895%20&display=popup&caption=An%20example%20caption%20&link=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fdialogs%2F%20&redirect_uri=https://developers.facebook.com/tools/explorer

But this opens a dialog and prompts user to share, so user need to click on "Share" button. Assuming user is already logged in with facebook (let's say on another tab of the browser) I need to enable the users to share content asynchronously without clicking that "Share" button on the facebook share dialog. I can't figure out a way. Users do not need to click the "Share" button on that dialog. In this way, as soon as a users clicks on a "Share This" button placed ON MY SITE, the content will be posted on users's fb wall.

Is that possible?

Was it helpful?

Solution

It is possible, but only with Facebook Authorization:

https://developers.facebook.com/docs/facebook-login/

The user has to authorize your app with the "publish_actions" permission, and you can post stuff on his wall with the PHP SDK:

https://github.com/facebook/facebook-php-sdk

Just keep in mind that the message always has to be 100% user generated. So, in order to share something like this, you would need to share without the "message" parameter, or you would have to include an input field where the user could set his own message.

Btw, for the functionality you described, there is a much better solution: https://developers.facebook.com/docs/plugins/like-button/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top