Reputation: 1056
Hi I have a facebook page (not an app), and I want to get the recent post on my website using PHP.
I don't know where to begin. I used google to look this up but all I could find was how to get post from an app.
Upvotes: 0
Views: 1388
Reputation: 20753
Its a very broad question. Anyways, just follow these steps-
If you are not registered as a facebook developers, register here: https://developers.facebook.com/
Then, create an app from here: https://developers.facebook.com/apps
Copy the app access token (app-id|app-secret
) to your php script- this is required, since to fetch the posts (public) from a page, you need a valid access token.
Get the contents using curl
or file_get_contents
of the url:
https://graph.facebook.com/{page-id/page-username}/posts?access_token={app-access-token}
(You can see the result by browsing above url in a browser) Just parse the JSON and get the posts as required. You'll not get all the posts in one go, but in the result you'll have the url to the next page.
Hope that helps!
Upvotes: 1