How to post status updates to Facebook fan page via API?
I have spent the last few days going through Facebook docs and dozens of blogs/websites and I still cant figure out how to post a status update (to a fan page that I manage) via the Facebook API (programatically)?
This is normally a couple li开发者_Go百科nes of code (with every other API in the world). I am just dumbfounded at the complexity and obscurity with Facebook.
Any pointers?
I don't want to build a UI or deal with sessions or use their "SDK", etc etc...I just want to do a RESTful HTTP POST/s (via PHP CURL).
Thanks in advance.
(BTW, I created an app (so I have an AppID and an AppSecret))
First step (which you have done) is to get the user access token with the publish_stream, manage_pages permissions. Call this USER_ACCESS_TOKEN.
Step 2, get the page access token and use that to publish to the page wall. Getting page access_token:
- Call to URL /me/accounts with the USER_ACCESS_TOKEN
- The result should include your fanpage and corresponding page token. Get that token, call this PAGE_ACCESS_TOKEN
- Then to post to the page wall, call /PAGE_ID/feed with your parameters and use the PAGE_ACCESS_TOKEN
For more details, see https://developers.facebook.com/docs/reference/api/page/ (look for Page Access Tokens and feed sections)
精彩评论