1 minute read

I want to create a facebook application, however currently all my production servers run PHP4.

Ultimately the project will be appear on your Facebook profile as a profile box.

I’m writing this while I begin creating my facebook application to assist people in a similar situation to myself.

So to begin with we will start at the Official Facebook Step-by-step Guide to Creating an Application.

This is all fine, until you get to about step 10 of “Integrating Hello World”, you quickly realise that this guide is for PHP5 users…

If you followed the guide correctly, you should have added yourself an application to Facebook, and got your API key, etc. You should also have a copy of the PHP (4 and 5) Client Library.

The next step is to follow the directions in the README file that comes with the Client Library and setup the “example” facebook application called Footprints.

Below is a step by step guide on how to achieve this:

  1. Create a new directory, and copy the following files from the library to it…
    • ./footprints/config.php
    • ./footprints/index.php
    • ./footprints/lib.php
    • ./php4client/facebook.php
    • ./php4client/facebookapi_php4_restlib.php
  2. Edit “index.php”, change “include_once ‘../client/facebook.php’;” to “include_once ‘facebook.php’;”
  3. Edit “config.php”, ensure you set the $api_key; $secret; $db_ip; $db_user; $db_pass; $db_pass; $db_name correctly. Note, obviously at this point you need to create a user/database and from reading the file, at the bottom you need to create the table called “footprints”, I did this by loading up phpmyadmin and running the SQL.
  4. To get this to work correctly for php4, you also need simplexml44, it should extract into a directory named “simplexml44-0_4_4”, you will need this.
  5. If like me you have discovered that lib.php errors because of the try-catch, don’t worry. just comment them out.

If you have done everything correctly, you should be at a point when you are ready to start editing the “index.php” and the functions in “lib.php”.

From this point onwards you need to understand PHP and read the developers documentation on the facebook website to continue.

It was interesting up until this point. I pretty much figured the best approach was to have an already existing project or site then you would simply make an application for that.

Tip: I suggest if you plan on making an application, make the project first.

Comments