First code for Facebook Application

The code below is my first Facebook application code.

<?php
// Tapos Pal
//
// Application: justpersonal
// File: ‘index.php’
// This is my first code for facebook
//

require_once ‘./facebook/facebook.php’;
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();

// Greet the currently logged-in user!
echo “<p>Hello, <fb:name uid=\”$user_id\” useyou=\”false\” />!</p>”;

// Print out at most 25 of the logged-in user’s friends,
// using the friends.get API method
$friends = $facebook->api_client->friends_get();
$friends = array_slice($friends, 0, 25);
?>
<fieldset>
<legend>Your Friends</legend>
<table>
<tbody>
<?php
foreach ($friends as $friend) {
?>

<tr>
<td><fb:name uid=”<?=$friend?>” useyou=”false” /></td><td><fb:profile-pic uid=”<?=$friend?>” size=”square” linked=”true” /></td>
</tr>

<?php

}
?>
</tbody>
</table>
</fieldset>

And this is the view on Facebook

Facebook Application 1

2 Responses to “First code for Facebook Application”

  1. শিপলু Says:

    Hello,
    why you post your apikey and apisecret ?
    Remove it.
    By the way, Its good (y)

  2. Tapos Says:

    Thanks a lot shiplu

Leave a Reply