HomePHP How to Add Facebook Comment Boxes with PHP
How to Add Facebook Comment Boxes with PHP
Facebook comments are a great way to optimize your site for social media and add a level of user-engagement to you site. Quality website comments can increase your website's credibility, as well as its traffic. This tutorial will teach you how to use Facebook's API Connect to integrate comment boxes on your website in a few simple steps, utilizing a little PHP and some elbow grease.
Before you can implement a Facebook comment box, you need to ensure that you meet the following requirements:
You have access to your website's template source code - this way you can add the Facebook comment code to your website files and then save it back to your server.
You have a verified Facebook Account – there are two ways you can verify your account; either by mobile phone or credit card.
Bear in mind that there are actually two versions of the Facebook comment box. The first one was released in 2009 - this is the old version that a lot of websites are still using. The latest release - which is basically a major overhaul - was released last March 2011. This tutorial will focus on how to add a Facebook comment box to your website using the latest version.
The First Step: Setup a Connect Application
You need to setup a connect application before you can integrate Facebook comment boxes on your website. To do so, follow the steps below:
Go to: http://www.facebook.com/developers/createapp.php
Login using your verified Facebook account.
After logging in, it will ask for permission to access your basic information; just click “Allow”.
If you see the message “Congratulations! You have successfully installed the Developer App!”, click “Setup new App”.
It will ask you for an App Name and if you agree with the Facebook terms.
You are then required to enter some basic information about your app(s). Here is an example of some of the required fields:
Click “Save changes”.
Facebook will then provide an App ID, API Key, App Secret and all of the details regarding your comment application. Take note of this data, copy and paste these details to a text file and save it to your computer in a safe location.
Click “Website” and you will see the core settings. Enter your Site URL and Site Domain, e.g.
Site URL= http://www.example.com/ and Site Domain is example.com
Click Save Changes.
Go to: https://www.facebook.com/developers/apps.php - you should see all of your apps there.
Click your comment application.
You should see all of the information pertaining to your apps (e.g. App ID, API key, APP Secret, contact email, etc).
Click “Edit Settings”. Only “About” and “Website” really need to be edited - you do not need to edit the rest (e.g. Facebook Integration to Advanced).
Click “Back to my Apps”. Under Directory status you should see: “Not Submitted”. You do not need to submit to the App Directory for your comment box to work.