Posting in Facebook Page wall from a PHP application

by   SJRANJAN

In this tutorial you can learn how to post in Facebook Page wall from a PHP application.

posttofb5

 

For this tutorial i have created a sample page named ‘New Movies’. You can create a page by using ‘Create Page’ option present in your facebook dashboard.

posttofb1

Also i have created a Facebook App named ‘Newmoviesapp’ by which am going to connect with facebook.

To create a facebook application…

* Go to https://developers.facebook.com/apps
* Login with your facebook credentials
* If you are not verified your mobile number with facebook you will be prompted to verify it.
* Click on “Create New App” and fill out the form.
* Once you created the app, under “Website with Facebook Login” add your project URL (i.e http://yourdomain.com/postfofbpage.php) and save the changes.

posttofb2

Now download Facebook PHP SDK here: https://github.com/facebook/facebook-php-sdk

Find the ‘src’ folder from the SDK download and keep it in your project folder. Create ‘postfofbpage.php’ file in the place where your ‘src‘ folder exists and place the following code.

Dont forgot to replace ‘APPID_FROM_FACEBOOK‘, ‘APPSECRET_FROM_FACEBOOK‘ and ‘YOUR_PAGE_URL‘ with your Facebook App details.

Now execute postfofbpage.php in browser and check the output. The Page will ask you to give permission for the app to post in your page wall.

posttofb3

Once you accept it you will be redirected to your php app where you can see a form by which you can post a status message to your facebook page wall.

posttofb4

Please checkout this video tutorial for line by line coding…

Share on :