Location: PHPKode > scripts > FBToolbox > fbtoolbox/example.php
<?php

/**
 * Facebook Toolbox
 *
 * A helper class for facebook application development. Very handy for
 * performing common facebook activities like:
 *
 * - Getting users profile information,
 * - Getting friend list,
 * - Getting application to user profile,
 * - Sending email notification message
 * - Sending Notification Message
 * - Publishing news feed or story to user profile.
 *
 * @author      Raju Mazumder <hide@address.com>
 * @package     FBToolbox
 * @copyright   2008-2009 Raju Mazumder
 * @link        http://www.stylephp.com
 * @since       Version 1.0
 */

// Include our files
include_once ('FBToolbox.class.php');

// Prepare the object
$fbToolboxObj = new FBToolbox('YOUR_API_KEY', 'YOUR_SECRET_KEY');

// Get user information
$userInfo = $fbToolboxObj->getUserInfo('575946061');
print_r($userInfo);

// Get friend list here
$friendList = $fbToolboxObj->getFriendList('575946061',false,0,20);
print_r($friendList);

// Send notification
$fbToolboxObj->sendNotification(array('575946061'),'test api class','app_to_user');

// Send email notification (CAUTION: your application must have permission from user)

$fbToolboxObj->sendEmail('575946061','test api class','test api class');

// Publish news feed
$news = '{*actor*} create a Facebook API Class for Facabook Developer.You can see it <a href="http://stylephp.com/">here</a>';
$body = 'So would you like to see it.<a href="http://stylephp.com">click here</a>';

$fbToolboxObj->publishNewsFeed($news, $body, '575946061');

// Add your application to your profile
$fbToolboxObj->addToProfile('575946061',"Wider FbMl","narrow fbml");
?>

<!-- you have to print this line to add application to user profile
if user click on addtoprofile link then above function will work -->
<div class="section_button"><fb:add-section-button section="profile"/></div>


Return current item: FBToolbox