Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2009-03-16 14:21
Size: 1,414 bytes
 

Contents

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');
//print_r($userInfo);
echo $userInfo[0]['current_location']['city'];

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

// 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>