Learning Facebook Application Development

Learning Facebook Application Development
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 35%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Complete guide to building Facebook applications in PHP
  • Fully illustrated with fun, functional step-by-step examples
  • Covers recent platform additions: Facebook JavaScript, Facebook AJAX
  • Create data-driven applications, employ multimedia, and more

Book Details

Language : English
Paperback : 240 pages [ 235mm x 191mm ]
Release Date : May 2008
ISBN : 1847193692
ISBN 13 : 9781847193698
Author(s) : Dr Mark Alexander Bain, Hasin Hayder
Topics and Technologies : All Books, Web Development, Open Source

Table of Contents

Chapter 1: Getting to Grips with the Facebook Platform
Chapter 2: Building a Facebook Application
Chapter 3: Databases, Dashboards, and the Profile
Chapter 4: Cooking User Data
Chapter 5: FBJS—The JavaScript
Chapter 6: Feeds
Chapter 7: Invitations and Notifications
Chapter 8: Photos
Chapter 9: Tools and Multimedia
  • Chapter 1: Getting to Grips with the Facebook Platform
    • The Purpose of the Facebook Platform
      • The Standard Web Application Model
      • The Facebook Web Application Model
    • The Facebook Platform Elements
      • The Facebook API
        • The Facebook API Test Console
      • FBML
        • The FBML Test Console
      • FQL
    • Obtaining the Facebook Client Libraries
    • Adding the Developer Application
    • Setting Up Your Application
      • Required Fields
      • Optional Fields
        • Base Options
        • Installation Options
        • Integration Points
    • Summary
  • Chapter 2: Building a Facebook Application
    • A Simple Facebook Application
      • Getting the Server Ready for Action
      • Creating Your First Facebook Application
        • The Application Initiation Code
        • The Application Code
        • Viewing the New Application
    • Developing the Simple Application
      • Examining Variables
      • Using FQL in Your Application
    • Writing to the Facebook Profile
      • Updating the Facebook Cache
    • Mock AJAX and Your Facebook Profile
      • Using a Form on Your Profile
      • Creating a Dynamic Combo-Box
      • Limiting Access to the Form
    • Storing Data—Keeping Files on Your Server
      • Storing FBML on Your Server
      • Storing Data on Your Server
    • Summary
  • Chapter 3: Databases, Dashboards, and the Profile
    • Setting up the Database
      • Setting the Root Password
      • Creating the Database
      • Adding a User
      • A Table for Our Data
      • Migrating Data
    • Accessing the Database from Your Facebook Application
      • Connecting to the Database
        • Using a Remote Database
      • Running Queries on the Database
        • Obtaining Data from the Database
        • Inserting Data into the Database
        • Deleting Data from the Database
      • Analyzing the Database
        • Calculating the Number Items in a Table
        • Grouping and Ordering Data
    • Updating Everyone's Profile
      • Updating the Facebook Cache—Remotely
        • Obtaining the Application Session ID
        • Using the Session ID to Write to a Profile
      • Updating More Than One User's Profile
      • Automating the Facebook Cache Update
        • A Simple Batch File
        • Using At Command to Control the Batch File
        • Using Cron to Control the Batch File
        • Pros and Cons of the Methods
    • Tracking Users
      • A Table for Your Users
      • Finding Your Application ID
      • Adding New Users
      • Removing a User
        • Defining a Post-Remove URL
      • Producing a List of Users
    • The Facebook Dashboard
      • Adding a Dashboard
        • Adding Help to the Dashboard
        • Adding an Action to the Dashboard
        • The Dashboard Create Button
    • Facebook JavaScript
      • The Facebook Contextual Dialog
    • Summary
  • Chapter 4: Cooking User Data
    • How to Fetch User Data
      • FBML
        • fb:name
        • fb:pronoun
        • fb:profile-pic
        • fb:user
      • Logical Tags
        • fb:is-in-network
        • fb:if-can-see
        • fb:if-can-see-photo
        • fb: if-is-friends-with-viewer
        • fb:is-if-group-member
        • fb:is-own-profile
        • fb:if-is-user
        • fb:if-user-has-added-app
        • fb:if-is-app-user
    • FQL
      • Let's Have a Look at the Schema
      • JOIN as Sub Query
      • Effective Searching with Structures
      • Common Snippets
        • Find All the friends of a User
        • Find All Friends Who Have the Current Application Installed
        • Find All Friends Whose Birthday Is Tomorrow
        • Find Which Groups a Specific User Is Subscribed To
        • Find All the Photos Uploaded by the User and in Any Album
      • Functions You can Use in FQL
    • Using Facebook API to Retrieve Information
      • Retrieving Profile Information
      • Retrieving List of Friends
      • Finding Out If Some Users are Friends
      • Retrieving Group Member's Information
      • Retrieving a User's Photo
    • Facebook Developers Tool
    • Summary
  • Chapter 5: FBJS—The JavaScript
    • How FBJS Works
      • DOM Manipulation Using FBJS
      • DRY Means Don't Repeat Yourself
      • Managing Stylesheet with FBJS
      • Creating a Drop-Down Menu in FBJS
    • Dialog
      • Displaying Information
      • Accepting User Input
      • Contextual or Pop Up?
      • Advanced Input System Using Dialogs
    • Events
    • AJAX
      • Common Tasks
        • Posting Parameters to Server Side Code
        • Posting Multibyte Characters
        • Canceling an AJAX Request
        • Making Sure that Users have to Log In for the AJAX Request
    • Summary
  • Chapter 6: Feeds
    • What Are Feeds?
    • How to Publish Feeds
    • Sample Application to Play with Feeds
      • So How Did it Work?
    • Publishing News Feed
    • Difference between These Two Methods
    • feed_publishTemplatizedAction
    • Summary
  • Chapter 7: Invitations and Notifications
    • Invitations
      • fb:request-form
      • fb:req-choice
      • fb:request-form-submit
      • fb:multi-friend-selector
      • fb:multi-friend-input
      • fb:application-name
    • Notifications
      • notifications_send
      • notifications_sendEmail
    • Tips for Effective Notification and Emailing
    • Summary
  • Chapter 8: Photos
    • Photo API
      • photos_getAlbum
      • Accessing from an External Application
      • Uploading Photo
        • Tagging Your Photos
    • Slideshow Application
    • Summary
  • Chapter 9: Tools and Multimedia
    • Creating a Discussion Board
    • Taking Comments from Users
    • Making a Wall Using fb:wall
    • Increasing Usability Using fb:switch
    • Using fb:random to Display a Random Option
    • Increasing Usability Using fb:switch
    • Sharing Content
      • Audio Sharing
      • Video Sharing
    • Multimedia Contents
      • Displaying Photo
      • Managing Audio
      • Managing Video (FLV Format)
    • Summary

Dr Mark Alexander Bain

Dr. Mark Alexander Bain first started customizing CRM systems back in the mid '90s when he was team leader for Vodafone's Cascade project – the team took the 'out-of-the-box' Clarify CRM and turned it into a radio base station planning application, complete with a workflow engine for passing jobs between the different departments involved in the planning, building, and implementation of a radio network. Since then he's lectured at the University of Central Lancashire, and currently Mark writes articles on all things Linux and Open Source for Linux Format, Newsforge.com and Linux Journal. SugarCRM customization, therefore, seems the obvious choice for this, his second book, since it combines Mark's knowledge of working with commercial CRMs and the Open Source philosophy. Mark works from his home on the edge of the Lake District in the UK, where he lives with his wife, two dogs and two cats, and gets the odd visit from his sons – Michael and Simon.

Hasin Hayder

Hasin Hayder graduated in Civil Engineering from the Rajshahi University of Engineering and Technology (RUET) in Bangladesh. He is a Zend-certified Engineer and expert in developing localized applications. He is currently working as a Technical Director in Trippert Labs and managing the local branch in Bangladesh. Beside his full time job, Hasin writes his blog at http://hasin.wordpress.com, writes article in different websites and maintains his open source framework Orchid at http://orchid.phpxperts.net. Hasin lives in Bangladesh with his wife Ayesha and his son, Afif.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 1 submitted: last submission 06 Aug 2012

Errata type: Code | Page number: 0

There has been a change in Facebook API in last couple of months. So most of the book's code is obsolete and might not work in the current version.


Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Learning Facebook Application Development +    BackTrack 5 Cookbook =
50% Off
the second eBook
Price for both: $34.95

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Learn Facebook application development through step-by-step examples.
  • Build data-driven Facebook applications, work with friends lists, photo galleries, multimedia, and more.
  • Work with Facebook’s security model to produce applications that are safe and functional.
  • Communicate with users through newsfeeds, notifications, invitations, and messages.
  • Learn the Facebook PHP API, and the various markup languages you'll need to build Facebook applications: Mock Ajax, FBML, FBJS (a variant of JavaScript especially for Facebook), and FQL.

In Detail

Using Facebook Applications, developers can add custom features to one of the most popular websites in the world. Facebook is the biggest social network among college students, and is gaining ground among professionals too. Facebook applications enable you to add new ways for users to interact with each other using Facebook.

Facebook applications are written in a server-side language, and hosted on the application developer's own server. They interface with Facebook, so that they appear to users to be part of Facebook itself.

This book shows PHP developers how to quickly get started building powerful Facebook applications, how to work with data stored in Facebook, including photos, and how to handle multimedia and other custom data within Facebook applications.

The book covers how to send notifications and invitations from within an application, update a user's profile, create application control panels for users, and much more.

A complete guide to creating Facebook applications using PHP, this book focuses on realistic, complete examples—building common features step-by-step, with plenty of practical advice.


This book builds on your knowledge as a PHP developer to provide a fast-paced, step-by-step tutorial in building Facebook applications. The book is packed with example code and demo applications, so that you can see techniques in action. Along the way we provide quick references to the most important aspects of the API, so you can refer back as you develop your own applications with the book.

Who this book is for

This book is for PHP5 developers who want to create custom Facebook applications. It assumes no knowledge of the Facebook API or Platform, but does assume that you are a Facebook user.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software