Home arrow PHP arrow 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.

  1. How to Add Facebook Comment Boxes with PHP
  2. Integrate Facebook Comments Code with Wordpress or PHP
  3. Configuring Your Facebook Comment Box
By: Codex-M
Rating: starstarstarstarstar / 2
June 22, 2011

print this article



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:

Application Name: My website Facebook comment box
Description: Comment box for example.com blog
Contact email: The same as the email address that you are using in Facebook.
Privacy Policy URL: The URL of your website privacy policy.
Terms of Service URL: The URL of your website terms and conditions.

  • 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.

>>> More PHP Articles          >>> More By Codex-M

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: