How to post to a Facebook page with PHP

后端 未结 3 770
南方客
南方客 2020-12-08 23:01

I would like to post to my own Facebook page\'s wall from my website using PHP.

I have the following:

  • Facebook Application with AppID, A
3条回答
  •  死守一世寂寞
    2020-12-08 23:29

    Step by step

    1. Authenticate a user that is a page admin (yourself)
    2. Request an extended access token (to get a 60 day variety as offline_access is gone). See https://developers.facebook.com/docs/offline-access-deprecation/
    3. Call Graph API me/accounts and search thru the resulting list to find the page you're interested in
    4. Take the page access token from the page and start using that for the calls to post
    5. It might be possible to get an extended access token for a page access token like described in step 2, please try and let us know if that can be done for page access token too.

    You can experiment with the above at https://developers.facebook.com/tools/explorer

    Happy Coding!

    EDIT

    For getting an access token without dialogs for any user, you can use https://developers.facebook.com/tools/access_token/ to get an access token.

提交回复
热议问题