In this recipe, we will create a Facebook application called "Your Good Luck Charm of the Day". It will forecast the name of the user's friend who will bring him/her good luck. The friend will be selected randomly. Let's begin creating this application.
You should have created
index.php as mentioned in the beginning of this chapter.
The following steps will describe the creation of the application:
index.phpand add the following code before the
<html>tag. Get the user's friends' details by using the
<?php $friends = $facebook->api('/me/friends');
$rand_key = array_rand($friends['data']); ...