際際滷

際際滷Share a Scribd company logo
Developing Facebook Application
                     A basic introduction




         facebook
Who we are




Abhishek Deshpande            Chetan Gole
MBA Student                   MCA Student
Follow @Fitehal               Follow @_techie
Abhishek@whoisabhi.com        me@thechetan.com
What is Facebook
More than 400 million active users on Facebook

People spend over 500 billion minutes per month on Facebook

over 160 million objects(pages, groups and events) that people interact

More than 70 translations

30% of Facebook users are from United States




                 Ref : http://www.facebook.com/press/info.php?statistics
Why Facebook App.

 Bring Existing App to FB World
 Campaigning on FB
 Building a Brand
Top Facebook Apps
Name                     Developer
1. FarmVille             Zynga
2. Static FBML           Facebook
3. Facebook for iPhone   Facebook
4. Birthday Cards        RockYou!
5. Texas HoldEm Poker    Zynga
6. Caf辿 World            Zynga
7. Causes                Causes
8. Mafia Wars            Zynga
9. PetVille              Zynga
10. Mobile               Facebook
What happens when you access
       Facebook App
What happens when
          you access Facebook
                  App




Image Credit : http://www.zilby.com/images/arch.png
Facebook Platform
 FBML / XFBML -Tag based markup language derived from
HTML / XML, with some extra Power to play with FB

 FQL - Facebook query language - Ideal for querying extra
data from Facebook Internal data tables.

FBJS - Facebook version of Javascript minimizing threats of
Cross scripting attacks. Supports Most of DOM - Based
manipulation Methods
Facebook API
          Facebook API calls are grouped into various action
categories, each focuses on different aspect of platform.

Let us look at some basic ones :
facebook.auth - basic authentication checks for facebook users
facebook.feed - Post to facebook news feed
facebook.friends - query fb for various checks on a user's friends
facebook.notification - send messages to users
facebook.profile - set FBML in user's profile
facebook.events - way to access FB events
facebook.groups - access information for facebook groups
facebook.photos - interact with facebook photos
Client Libraries
PHP
      - Easy to use
      - Officially Supported
      - Wide options for Hosting



          Also Libraries are Available for Python, Ruby, .NET, Java & C++
FBML
 Facebook markup language derived from HTML /
XML.

 To distinguish between HTML and FBML in app code,
you need to prefix fb: to FBML tags

 More than 100 tags to play with.
<fb:name uid="1431430963" />       => you
<fb:name uid="1431430963" capitalize="true" /> => You
<fb:name uid="1431430963" possessive="true" /> => Your
<fb:name uid="1431430963" reflexive="true" /> => Yourself
<fb:name uid="1431430963" useyou="false" />     => Abhishek Deshpande
<fb:name uid="672981152" />             => Chetan Gole
<fb:name uid="672981152" firstnameonly="true" /> => Chetan
Add Bookmark


<fb:bookmark />
Shows Dialog
<fb:dialog id="simple-dialog">
<fb:dialog-title>simple Dialog</fb:dialog-title>
<fb:dialog-content> This is some garbage content to be displayed. </fb:dialog-
content>
<fb:dialog-button type="button" value="Okay!" close_dialog="1" />
</fb:dialog>
<a href="" clicktoshowdialog="simple-dialog">show Dialog</a>
FQL

 Same syntax as ANSI-SQL

 No implementation for Limit, Group
by, Order By Clauses
User Table
uid, first_name , middle_name, last_name, name , pic_small
, pic_big, pic_square, pic, affiliations, profile_update_time
,timezone ,religion ,birthday ,birthday_date ,sex
,hometown_location , meeting_sex , meeting_for ,
relationship_status , significant_other_id , political ,
current_location , activities, interests ,is_app_user , music ,
tv , movies , books , quotes ,about_me, hs_info ,
education_history , work_history ,notes_count , wall_count ,
status , has_added_app , online_presence , locale ,
proxied_email , profile_url , email_hashes ,
pic_small_with_logo , pic_big_with_logo ,
pic_square_with_logo , pic_with_logo , allowed_restrictions
, verified , profile_blurb , family , username , website ,
is_blocked , contact_email , email
$fql = "Select name, pic FROM user where
uid='100000860190302'";
$fql_result=$facebook->api_client->fql_query($fql);
print_r($fql_result);

Array (
       [name] => Pranay Patil
       [pic] =>
http://profile.ak.fbcdn.net/hprofile-ak-
sf2p/hs624.snc3/27399_100000860190302_8058_s.jpg
)
Functions (FQL)
 now()          Returns the current time.
 rand()         Generates a random number.
 strlen(string)        Returns the length of the string.
 concat(string, ...)   Concatenates the given strings (can take any
number of strings).
More Functions (FQL)
 substr(string, start, length) Gets a substring of the string.
 strpos(haystack, needle) Returns the position of needle in
haystack, or -1 if it is not found.
 lower(string) Converts the string to lower case.
 upper(string)           Converts the string to upper case.
 strip_tags(field) Strips HTML markup and encoding from a
specified FQL field.
FBJS
 <script> Tag is allowed
 Javascript/DOM "id" values are rewritten on-the-fly

<a href="#" onclick="new Dialog().showMessage('Dialog', 'Hello
World.'); return false;"> Display Dialog.</a>
Developer resources
 Test Console http://developers.facebook.com/tools.php

 Developer Application http://www.facebook.com/developers/

 Developer Wiki http://wiki.developers.facebook.com
if (questions)
{
       for Q in questions:
              answer(Q)
} else
{
       print "Thank you!"
}

More Related Content

Developing Facebook Application - Nagpur PHP Meetup

  • 1. Developing Facebook Application A basic introduction facebook
  • 2. Who we are Abhishek Deshpande Chetan Gole MBA Student MCA Student Follow @Fitehal Follow @_techie Abhishek@whoisabhi.com me@thechetan.com
  • 3. What is Facebook More than 400 million active users on Facebook People spend over 500 billion minutes per month on Facebook over 160 million objects(pages, groups and events) that people interact More than 70 translations 30% of Facebook users are from United States Ref : http://www.facebook.com/press/info.php?statistics
  • 4. Why Facebook App. Bring Existing App to FB World Campaigning on FB Building a Brand
  • 5. Top Facebook Apps Name Developer 1. FarmVille Zynga 2. Static FBML Facebook 3. Facebook for iPhone Facebook 4. Birthday Cards RockYou! 5. Texas HoldEm Poker Zynga 6. Caf辿 World Zynga 7. Causes Causes 8. Mafia Wars Zynga 9. PetVille Zynga 10. Mobile Facebook
  • 6. What happens when you access Facebook App
  • 7. What happens when you access Facebook App Image Credit : http://www.zilby.com/images/arch.png
  • 8. Facebook Platform FBML / XFBML -Tag based markup language derived from HTML / XML, with some extra Power to play with FB FQL - Facebook query language - Ideal for querying extra data from Facebook Internal data tables. FBJS - Facebook version of Javascript minimizing threats of Cross scripting attacks. Supports Most of DOM - Based manipulation Methods
  • 9. Facebook API Facebook API calls are grouped into various action categories, each focuses on different aspect of platform. Let us look at some basic ones : facebook.auth - basic authentication checks for facebook users facebook.feed - Post to facebook news feed facebook.friends - query fb for various checks on a user's friends facebook.notification - send messages to users facebook.profile - set FBML in user's profile facebook.events - way to access FB events facebook.groups - access information for facebook groups facebook.photos - interact with facebook photos
  • 10. Client Libraries PHP - Easy to use - Officially Supported - Wide options for Hosting Also Libraries are Available for Python, Ruby, .NET, Java & C++
  • 11. FBML Facebook markup language derived from HTML / XML. To distinguish between HTML and FBML in app code, you need to prefix fb: to FBML tags More than 100 tags to play with.
  • 12. <fb:name uid="1431430963" /> => you <fb:name uid="1431430963" capitalize="true" /> => You <fb:name uid="1431430963" possessive="true" /> => Your <fb:name uid="1431430963" reflexive="true" /> => Yourself <fb:name uid="1431430963" useyou="false" /> => Abhishek Deshpande <fb:name uid="672981152" /> => Chetan Gole <fb:name uid="672981152" firstnameonly="true" /> => Chetan
  • 14. Shows Dialog <fb:dialog id="simple-dialog"> <fb:dialog-title>simple Dialog</fb:dialog-title> <fb:dialog-content> This is some garbage content to be displayed. </fb:dialog- content> <fb:dialog-button type="button" value="Okay!" close_dialog="1" /> </fb:dialog> <a href="" clicktoshowdialog="simple-dialog">show Dialog</a>
  • 15. FQL Same syntax as ANSI-SQL No implementation for Limit, Group by, Order By Clauses
  • 16. User Table uid, first_name , middle_name, last_name, name , pic_small , pic_big, pic_square, pic, affiliations, profile_update_time ,timezone ,religion ,birthday ,birthday_date ,sex ,hometown_location , meeting_sex , meeting_for , relationship_status , significant_other_id , political , current_location , activities, interests ,is_app_user , music , tv , movies , books , quotes ,about_me, hs_info , education_history , work_history ,notes_count , wall_count , status , has_added_app , online_presence , locale , proxied_email , profile_url , email_hashes , pic_small_with_logo , pic_big_with_logo , pic_square_with_logo , pic_with_logo , allowed_restrictions , verified , profile_blurb , family , username , website , is_blocked , contact_email , email
  • 17. $fql = "Select name, pic FROM user where uid='100000860190302'"; $fql_result=$facebook->api_client->fql_query($fql); print_r($fql_result); Array ( [name] => Pranay Patil [pic] => http://profile.ak.fbcdn.net/hprofile-ak- sf2p/hs624.snc3/27399_100000860190302_8058_s.jpg )
  • 18. Functions (FQL) now() Returns the current time. rand() Generates a random number. strlen(string) Returns the length of the string. concat(string, ...) Concatenates the given strings (can take any number of strings).
  • 19. More Functions (FQL) substr(string, start, length) Gets a substring of the string. strpos(haystack, needle) Returns the position of needle in haystack, or -1 if it is not found. lower(string) Converts the string to lower case. upper(string) Converts the string to upper case. strip_tags(field) Strips HTML markup and encoding from a specified FQL field.
  • 20. FBJS <script> Tag is allowed Javascript/DOM "id" values are rewritten on-the-fly <a href="#" onclick="new Dialog().showMessage('Dialog', 'Hello World.'); return false;"> Display Dialog.</a>
  • 21. Developer resources Test Console http://developers.facebook.com/tools.php Developer Application http://www.facebook.com/developers/ Developer Wiki http://wiki.developers.facebook.com
  • 22. if (questions) { for Q in questions: answer(Q) } else { print "Thank you!" }