How can I display Facebook Public Page Posts on my website?
- Log into the Facebook account
- Visit https://developers.facebook.com/apps,
- On the top right of the next screen, click on the button “+Create New App”
- Fill all the information and proceed further
- On the next screen you will see “App ID:” and “APP Secret:” You will need it when requesting.
- To get Facebook posts by request, you need to implement Facebook login system in your website
Here is the code in Drupal to implement Facebook login system
To send this request you need to get "manage_pages" permission first otherwise it will give error.
Facebook will send a code to your redirect URL and you will get the “User Access Token” with the help of this code
And then you need to send the request again to get the user account information
Then you can find out which page the user has allowed and then you need to send a request to that page for the “Page Access Token”.
Here is a screenshot of the full code.
If you get the page access token successfully then you need to send a request to fetch the page posts
Now you can display these posts on your page where you want.