Building a facebook application by php

1,187 views
1,052 views

Published on

Speaker trinh van thanh
Work at: Seta:CinQ

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,187
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
164
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Building a facebook application by php

  1. 1. Building Facebook Apps using PHP Trinh Van Thanh Facebook App Leader Japan Division SETA International Vietnam We Know Business, We Know Technology, We Are Global
  2. 2. ABOUT ME ABOUT US TRINH VAN THANH  Software Outsourcing Facebook App Development Leader  150 developers in @SETA International LLC since 2010 Hanoi, VN A Facebook Lover. Facebook 24/7   Market: US, Japan 1000 hours developing Facebook Apps  2nd Join PHP Day as 20 Facebook Apps built Sponsor and Presentor Top 3 Facebook App in Japan  http://www.seta- international.co.jp/ Contact: thanhtv6075@setacinq.com.vn tvthanhdl@gmail.com We Know Business, We Know Technology, We Are Global
  3. 3. AGENDA  WHY FACEBOOK  BUILDING FACEBOOK APPS USING PHP  DEMO We Know Business, We Know Technology, We Are Global
  4. 4. WHY FACEBOOK We Know Business, We Know Technology, We Are Global
  5. 5. FACEBOOK IS HUGE ECOSource: The perfect Startup, Fabemovel We Know Business, We Know Technology, We Are Global
  6. 6. PERFECT SCALING –VERY STABLE PLATFORM (NOW)Source: The perfect Startup, Fabemovel We Know Business, We Know Technology, We Are Global
  7. 7. Social media on Facebook The Viral LoopSource: The perfect Startup, Fabemovel We Know Business, We Know Technology, We Are Global
  8. 8. Facebook’s platform is built on three main toolsSource: The perfect Startup, Fabemovel We Know Business, We Know Technology, We Are Global
  9. 9. BUILDING FACEBOOKAPPS BY PHP We Know Business, We Know Technology, We Are Global
  10. 10. Facebook apps?• Apps on Facebook.com – Canvas app – Page tab – Mobile web We Know Business, We Know Technology, We Are Global
  11. 11. Canvas Apps• It is just the “home” page of the application where the app is described to those who might want to use it.• Example: http://apps.facebook.com/monipla/ We Know Business, We Know Technology, We Are Global
  12. 12. Canvas Apps760px(default) Advertising CPM and CPC We Know Business, We Know Technology, We Are Global
  13. 13. Page Tab• Facebook page: are a heavily used feature of Facebook. Major brands, celebrities, etc. use Facebook Pages as their "social home" on the web. One of the most interesting features of Apps on Facebook.com is the ability for your app to be used within the context of a Facebook Page.Example: - SETA:CINQ Vietnam, Ltd - TERRAS - PHPDay2012 - FordJapan - Pargolfonline - …• Page tab are apps on Facebook Page. We Know Business, We Know Technology, We Are Global
  14. 14. Page Tab810px(max) advertisingWe Know Business, We Know Technology, We Are Global
  15. 15. Page Tab520px(default)We Know Business, We Know Technology, We Are Global
  16. 16. Mobile WebSource: socialbakers We Know Business, We Know Technology, We Are Global
  17. 17. Mobile Web• Mobile web apps are built using web technologies including HTML5, Javascript and CSS. You can build once and deploy everywhere, including on iPhone, iPad and Android. - Hummerbinbyun We Know Business, We Know Technology, We Are Global
  18. 18. Mobile WebWe Know Business, We Know Technology, We Are Global
  19. 19. Open Graph• Social network• Social media• Open graph 1.0 -> Like action only• Open graph 2.0 -> customize actions We Know Business, We Know Technology, We Are Global
  20. 20. Open Graph 1.0We Know Business, We Know Technology, We Are Global
  21. 21. Open Graph 2.0We Know Business, We Know Technology, We Are Global
  22. 22. Build apps use PHP SDK with Graph API (Becoming a Facebook Developer)• Requires• Resources• How to build facebook app We Know Business, We Know Technology, We Are Global
  23. 23. Requires• PHP (Support PHP, JS, IOS, Android SDK)• JS• HTML (HTML5 with mobile web)• CSS (CSS3 with mobile web)• MySQL (optional) We Know Business, We Know Technology, We Are Global
  24. 24. Resources• Tools - https://developers.facebook.com/tools/• Bugs - https://developers.facebook.com/bugs• Developer Application - https://developers.facebook.com/apps• Developer Blog - https://developers.facebook.com/blog/• Developer Roadmap - https://developers.facebook.com/roadmap/• Document - https://developers.facebook.com/docs/• PHP SDK - https://github.com/facebook/facebook-php-sdk We Know Business, We Know Technology, We Are Global
  25. 25. Create a Facebook App (Create)• Start by visiting the Developer App. If you havent created an application before you will be prompted to add the Developer Application. We Know Business, We Know Technology, We Are Global
  26. 26. Create a Facebook App (Configuring Canvas apps) Enable auth on domain & subdomainOnly app developerwill be able to use app Required if check permission Default: 760px Fluid: 100% We Know Business, We Know Technology, We Are Global
  27. 27. Code example (use PHP SDK)• Installing and Initializing We Know Business, We Know Technology, We Are Global
  28. 28. Code example (Graph API)• Use static: Facebook::api(/* polymorphic */);• Use object: $facebook->api(/* polymorphic */);• /* polymorphic */:= {$path, $method, $params} We Know Business, We Know Technology, We Are Global
  29. 29. Code example (Graph API)We Know Business, We Know Technology, We Are Global
  30. 30. Code example (Graph API)• Function fbRedirect(): We Know Business, We Know Technology, We Are Global
  31. 31. Code example (Post Status)• Permission: publish_stream$facebook->api(/me/feed, POST, array( link => www.yourdomain.com, message => Posting with the PHP SDK! on http://yourdomain.com )); We Know Business, We Know Technology, We Are Global
  32. 32. Code example (Post Photo)• Permissions: publish_stream, photo_upload//Required set to upload photo $facebook->setFileUploadSupport( true );$photo = path-to-photo; //required in host login to apps$message = Photo upload via the PHP SDK! on http://yourdomain.com;$facebook->api(/me/photos, POST, array( source => @ . $photo, message => $message, )); We Know Business, We Know Technology, We Are Global
  33. 33. Code example (count LIKE of an url)$link = LINK_TO_COUNT;$likes = $facebook->api(array( query => SELECT share_count, like_count, comment_count, total_count FROM link_stat WHERE url IN(" . $link . "), method => fql.query)); We Know Business, We Know Technology, We Are Global
  34. 34. Create a Facebook App (Configuring Page tab)• You can find these settings in the "Basic" section of your apps settings in the Developer App under Select how your app integrates with Facebook. Click Page Tab to expand the Page Tab settings, and the Page Tab fields will appear We Know Business, We Know Technology, We Are Global
  35. 35. Create a Facebook App (Page Tab Width)• The amount of space available to your tab app is bounded by the outer context of Facebook. It may be configured to display with a width of 520 pixels (default) or 810 pixels. We Know Business, We Know Technology, We Are Global
  36. 36. Code example (Page tab: check LIKE page)$signedRequest = $facebook->getSignedRequest();$isLiked = $signedRequest["page"]["liked"];if( $isLiked ){ //load visible contents to page tab}else{ //load invisible contents to page tab //Show message “click like button to app”} We Know Business, We Know Technology, We Are Global
  37. 37. Combined with JS SDK (loading js)• Add to body: We Know Business, We Know Technology, We Are Global
  38. 38. Combined with JS SDK (loading js)• FB.Canvas.setAutoGrow(timeout);• FB.Canvas.setSize();• FB.Canvas.scrollTo(); We Know Business, We Know Technology, We Are Global
  39. 39. Facebook for Websites (social plugins)• Like• Share• Comment• http://developers.facebook.com/docs/plugins We Know Business, We Know Technology, We Are Global
  40. 40. DEMO We Know Business, We Know Technology, We Are Global
  41. 41. DISCUSSION We Know Business, We Know Technology, We Are Global
  42. 42. THANK YOU http://www.facebook.com/setacinq We Know Business, We Know Technology, We Are Global

×