After knowing how to create the Facebook application instance in PHP SDK, let's start using PHP SDK to code some application specific features.

We will start this by migrating the "My friends" tab in Our 1st FB App.


Checking if the User has signed on to Facebook or not

Querying User's Facebook ID


Partial Migrating of "My Friends" Tab

In this tutorial, we will first migrate our application to display only the hello message in the "My Friends" page.

To do this, amend my_friend.php according to the followings:

Sample code of the above is shown below:

if ($fbme) {
  echo "<p>Hello, <fb:name uid=\"$fbme[id]\" useyou=\"false\" />!</p>";
} else {
echo "<p>&nbsp;</p>";
echo "<h3>Please sign on before using this demo appl. </h3>";
echo "<p>&nbsp;</p>";

At the moment, while there is no valid session exists, the following message will be displayed:

Facebook dashboard header


We will learn more about the Graph API in the later part of this series.

BTW, if you want to test drive "Our 1st FB App (PHP SDK)", it is here. But don't expect all the features are working at this moment. Remember, migration is still in progress!