简体   繁体   中英

How can I let my friends post on my facebook page wall, from my website?

Okay this question is very simple: I have a facebook page, and a website. People can post things on the facebook page wall (obviously) and I would like to put a button on my website that lets them post (messages or pictures) to my facebook wall.

Edit: I tried using the comment box and it doesn't let users post directly to my facebook page wall (which is what I want).

Edit: I'm currently investigating a deprecated facebook functionality using post object

Any ideas ? Anything, even remotely connected to how I can do this is highly appreciated.

Facebook推出了Facebook评论框

Sounds like a bit of a risky operation; the comments box (suggested by loler) is the safest as this is contained.

But if you must go ahead, you should be able to do it. Warning - not advising it unless you otherwise moderate the posts - and it might be against terms and conditions to let others post to your wall, so check first!

  1. Create yourself an "app"
  2. Log into your own app, make the token a long lived token and store that token.
  3. (Remember to perviodically extend your token to prevent it running out after 60 days).

Then, separately:

  1. Create a PHP form (or other page) that accepts details to be posted to Facebook
  2. Then post using your saved token (and with your app credentials) using the Graph API through PHP.

Do not do this via Javascript as you need your access token, and you don't want to reveal that to the world.

To clarify a little bit, I wanted to use a "post" button on my facebook page that lets any users post directly to my facebook page wall, using my facebook app. Here's what you need to do if you want to do this

1) Get permission for the app to publish on their behalf. For this, the users need to be redirected to:

https://www.facebook.com/login.php?api_key=<your-api-key>&
cancel_url=<your-cancel-url>&display=popup&
fbconnect=1&next=<your-success-url>&
return_session=1&session_version=3&v=1.0&req_perms=email%2Cpublish_stream

2) After you initialize the Facebook Javascript SDK, use the following function:

FB.api('/mypage/feed', 'post', { body: 'the body', message: 'some-text' }, function(response) {
        if (!response || response.error) {
            alert('Error occured');
        } else {
            alert('Post ID: ' + response);
        }
        });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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