PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of raju mazumder   FBToolbox   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: This is the example file where I have shown here how to use this class.
Class: FBToolbox
Facebook API wrapper
Author: By
Last change: There are two function added at class so example file has changed something.
Date: 14 years ago
Size: 1,414 bytes


Class file image Download
// 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('FB USER ID');
echo $userInfo[0]['current_location']['city'];

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

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

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

$fbToolboxObj->sendEmail('FB USER ID','test api class','test api class');

// Publish news feed

$one_line_story_templates[] = '{*actor*} has developed a php wrapper
class for facebook application developer.';
//You have to run this function only one times to get template bundle id
$templateBundleId = $fbToolboxObj->getTemplateBundleId($one_line_story_templates);

$fbToolboxObj->publishNewsFeed('FB USER ID',$templateBundleId);

// Add your application to your profile
$fbToolboxObj->addToProfile('FB USER ID',"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>