Your SlideShare is downloading. ×
0
Tích hợp trao đổi dữ liệu với        Facebook      By: Nguyễn Mạnh Tiến            Tầm tay
Agenda•   FB connection•   FB graph API•   How work?•   Technical steps•   FB and Open Social
Facebook overviewAbout 400 million monthly  active usersAbout 60 million Connect usersAbout 83% people trust their  friend...
Facebook connection?●   The next evolution of Facebook Platform● It enables the integration of the Facebook Platform into ...
Facebook to my site?• Identity: Seamlessly connect the users Facebook account andinformation with your site.• Friends: Bri...
Should Use Facebook Connect?• One-click Login: Allow users to log in with their Facebook identity andallow your site to ac...
Facebook core
Facebook Graph API?– Facebooks core– Presents a simple, consistent view of the Facebook    social graph– Every object in t...
Objecthttps://graph.facebook.com/platform
Relationshipshttps://graph.facebook.com/ID/CONNECTION_TYPE
How does it work?
Connect
Interactive with Facebook
Technical steps
First step• Yêu cầu chung: YOUR_APP_ID• đăng ký với FB để lấy mã ID tương tác với ứng dụng của FB     (FaceBook API)• http...
Next step : Authentication    Authenticate on your site (out of FB). Method of authentication :in code - server side : Th...
ReadingUsing access token key, issuing HTTP GET requests , return data in jsonví dụ truy cập feed :https://graph.facebook....
PublishingUsing access token key: issuing HTTP POST requestsPhp code tương ứng :<?php$token = 3523452345.....$message = "H...
Alternatively, OpenSocial
Market Size and Competition•   Ideally speaking, OpenSocial has    a market potential for 250 million    users as opposed ...
Technical Differences• Facebook requires proprietary languages (FBML, FQL,  FBJS). Google requires XML and JavaScript• Goo...
Language SupportFacebook API                   OpenSocial API•   FBML                       •   XHTML/XML•   FQL          ...
FB and Open social• The choice of your platform should depend on  demographic• OpenSocial is modeled after Facebook. So if...
Resources• Getting Started Guide:http://wiki.developers.facebook.com/index.php/Trying_Out_Facebook_Connect• Facebook Conne...
Thank youNguyễn Mạnh Tiếntien.nguyen@tamtay.vnwww.tamtay.vn
Upcoming SlideShare
Loading in...5
×

Php day 2011 - Interactive-with-facebook

1,096

Published on

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

  • Be the first to like this

No Downloads
Views
Total Views
1,096
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Php day 2011 - Interactive-with-facebook"

  1. 1. Tích hợp trao đổi dữ liệu với Facebook By: Nguyễn Mạnh Tiến Tầm tay
  2. 2. Agenda• FB connection• FB graph API• How work?• Technical steps• FB and Open Social
  3. 3. Facebook overviewAbout 400 million monthly active usersAbout 60 million Connect usersAbout 83% people trust their friends over any other source.About 36 TB/day
  4. 4. Facebook connection?● The next evolution of Facebook Platform● It enables the integration of the Facebook Platform into your own site, allowing your users to:– Seamlessly "connect" their Facebook account andinformation with your site– Connect and find their friends who also use your site– Share information and actions on your site with theirfriends on Facebook through their profile pages &newsfeeds
  5. 5. Facebook to my site?• Identity: Seamlessly connect the users Facebook account andinformation with your site.• Friends: Bring a users Facebook friends into your site. You caneven link friends that have existing accounts.• Discovery: Publish information back into their friends NewsFeeds on Facebook.• Privacy: Bring dynamic privacy to your site.• Reliability: The full power and flexibility of FacebookPlatform.
  6. 6. Should Use Facebook Connect?• One-click Login: Allow users to log in with their Facebook identity andallow your site to access their Facebook profile information.• Increased engagement: Leverage users personal interests to show morerelevant information and surface personalized content from friends suchas reviews or comments.• New forms of distribution: Users can share content and actions taken onyour site with friends back on Facebook through feed, invites, and othersocial communication channels on Facebook.
  7. 7. Facebook core
  8. 8. Facebook Graph API?– Facebooks core– Presents a simple, consistent view of the Facebook social graph– Every object in the social graph has a unique ID. You can access the properties of an object by requesting https://graph.facebook.com/ID– People and pages with usernames can be accessed using their username as an ID– All responses are JSON objects– Relationships– Reading, Searching, Publishing, Deleting, Analytics
  9. 9. Objecthttps://graph.facebook.com/platform
  10. 10. Relationshipshttps://graph.facebook.com/ID/CONNECTION_TYPE
  11. 11. How does it work?
  12. 12. Connect
  13. 13. Interactive with Facebook
  14. 14. Technical steps
  15. 15. First step• Yêu cầu chung: YOUR_APP_ID• đăng ký với FB để lấy mã ID tương tác với ứng dụng của FB (FaceBook API)• http://developers.facebook.com/setup/
  16. 16. Next step : Authentication Authenticate on your site (out of FB). Method of authentication :in code - server side : The server-side flow is used whenever you need to call the Graph API from your web serverin html - client side : The client-side flow is used when you need to make calls to the Graph API from a client, such as JavaScript running in a Web browser or from a native mobile or desktop app Iusse request :https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email,read_stream Return code to get access token key:Kết thúc Authentication thì FB sẽ trả về code để lấy token code và access vào graph protocol của FB để lấy các loại dữ liệu khácnguồn tham khảo : http://developers.facebook.com/docs/authentication
  17. 17. ReadingUsing access token key, issuing HTTP GET requests , return data in jsonví dụ truy cập feed :https://graph.facebook.com/id/feed?access_token=2227470867|2.AQA_W4- fDdlG-erj.3600.1306126800.0-1090002606|Ktp_XdsULJo0j-CAaUratCxJKqMPhp code:<?php$readfeed_url = sprintf(https://graph.facebook.com/%d/feed?access_token=%s, $fbdata[fbid], $fbdata[access_token] ) ;$feed = json_decode(file_get_contents($readfeed_url));?>
  18. 18. PublishingUsing access token key: issuing HTTP POST requestsPhp code tương ứng :<?php$token = 3523452345.....$message = "Hello, Arjun. I like this new API";$uid = arjun$url = https://graph.facebook.com/$uid/feed? access_token=$token&message=$message&method=post$result = file_get_contents($url);?>
  19. 19. Alternatively, OpenSocial
  20. 20. Market Size and Competition• Ideally speaking, OpenSocial has a market potential for 250 million users as opposed to 64 million active users on Facebook• 15,000 Applications on Facebook. Difficult to rapidly grow user base due to a saturated market• Most existing Google Widgets can run on OpenSocial. Results? Difficult to rapidly grow user base due to existing competition
  21. 21. Technical Differences• Facebook requires proprietary languages (FBML, FQL, FBJS). Google requires XML and JavaScript• Google provides an IDE (aka Google Gadget Editor)• Google hosts applications for free. Facebook doesn’t
  22. 22. Language SupportFacebook API OpenSocial API• FBML • XHTML/XML• FQL • JavaScript• FBJS • Full Support for AJAX• Partial support for AJAX • Backend languages like• Backend languages like PHP, Java, .NET on PHP, Java, .NET on Canvas Canvas
  23. 23. FB and Open social• The choice of your platform should depend on demographic• OpenSocial is modeled after Facebook. So if you’ve built a Facebook application before, it is relatively easy to learn OpenSocial• “Write Once, Run Anywhere” is not exactly true. An Orkut specific OpenSocial app. Might not necessairly run on Hi5
  24. 24. Resources• Getting Started Guide:http://wiki.developers.facebook.com/index.php/Trying_Out_Facebook_Connect• Facebook Connect Policies:http://wiki.developers.facebook.com/index.php/Facebook_Connect_Policies• Facebook Connect: Developers Centralhttp://developers.facebook.com/docs/• Graph APIhttp://graph.facebook.com/• Websites using Facebook Connect sorted by active monthly users http://www.allfacebook.com•Opensocialhttp://code.google.com/apis/opensocial/
  25. 25. Thank youNguyễn Mạnh Tiếntien.nguyen@tamtay.vnwww.tamtay.vn
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×