Posting to Facebook with PHP Script is possible just like our Post on WordPress get posted on Facebook Page via Facebook’s API. Here is a workaround. Around this topic, we have two important guides – Publishing WordPress Post to Facebook Page via App Guide and the new Add Custom Via Name in Facebook Posts guide.
Posting to Facebook with PHP Script : What is the Cheat Sheet?
There is absolutely no shortcut. At first you have to setup a new Facebook application in the way we have shown in the linked guide – you can search on this website for more such guides with Heroku Cloud. In the application settings, the Authentication settings must be ticked for Facebook Pages. This is for Page.
For Timeline, one person, apparently has a ready-made solution, but it is paid :
---
1 | http://w3lessons.info/2013/04/21/facebook-wall-script-3-0-timeline-oauth-location-sharing-smileys-many-more/ |
Posting to Facebook with PHP Script : Sample Code
The process of building the post to Facebook PHP script requires the following steps:
- Download Facebook PHP SDK
- Register the Facebook application
- Build the Post to Facebook script
As we can use Heroku Cloud PaaS as host, hosting is actually free. The basic script should be like this :
PHP part is creating problem if included in this post, so here is updated gist :
If you get “The user hasn’t authorized the application to perform this action”, then there is some conflict with your FB App settings. Always, read the official doc :
1 | https://developers.facebook.com/docs/ |