Successfully reported this slideshow.

Facebook Apps: Ein Entwicklungsleitfaden - WMMRN

2

Share

Upcoming SlideShare
Prashant Sridharan
Prashant Sridharan
Loading in …3
×
1 of 19
1 of 19

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Facebook Apps: Ein Entwicklungsleitfaden - WMMRN

  1. 1. Facebook Apps: Ein Entwicklungsleitfaden
  2. 2. Facebook Apps: Entwicklungsleitfaden Über mich  Stephan Hochdörfer, bitExpert AG  Department Manager Research Labs  S.Hochdoerfer@bitExpert.de  @shochdoerfer  http://www.facebook.com/shochdoerfer
  3. 3. Facebook Apps: Entwicklungsleitfaden Damals: Umfangreiches Ökosystem
  4. 4. Facebook Apps: Entwicklungsleitfaden Heute: Die Graph API
  5. 5. Facebook Apps: Entwicklungsleitfaden Die Graph API: REST https://graph.facebook.com/1047746467
  6. 6. Facebook Apps: Entwicklungsleitfaden Die Graph API: REST + JSON { "id": "1047746467", "name": "Stephan Hochdoerfer", "first_name": "Stephan", "last_name": "Hochdoerfer", "link": "https://www.facebook.com/shochdoerfer", "username": "shochdoerfer", "gender": "male", "locale": "de_DE" }
  7. 7. Facebook Apps: Entwicklungsleitfaden /me/friends?access_token=
  8. 8. Facebook Apps: Entwicklungsleitfaden Die erste Facebook App
  9. 9. Facebook Apps: Entwicklungsleitfaden Die erste Facebook App <!DOCTYPE html> <html xmlns:fb="https://www.facebook.com/2008/fbml"> <body> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({ appId: 'your app id', status: true, cookie: true, xfbml: true }); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol+'//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); </script> </body> <html>
  10. 10. Facebook Apps: Entwicklungsleitfaden
  11. 11. Facebook Apps: Entwicklungsleitfaden
  12. 12. Facebook Apps: Entwicklungsleitfaden Fan oder Nicht Fan? <?php $request = $facebook->getSignedRequest(); $isFan = isset($request['page']) && isset($request['page']['liked']); ?>
  13. 13. Facebook Apps: Entwicklungsleitfaden Login / Authentifzierung FB.getLoginStatus(function(response) { if (response.session) { // User eingeloggt } else { // Versuchen den User einzuloggen FB.login(function(response) { if(response.session) { if(response.perms) { // ist eingeloggt.... } } }, { perms: 'publish_stream, offline_access' }); } });
  14. 14. Facebook Apps: Entwicklungsleitfaden Wallpost (JS Style) var pageId = 12345678; var post = { message: '', name: 'Der Name des Links', caption: 'Die Beschreibung', link: 'http://www.facebook.com/'+pageId, attribution: 'Meine App' }; FB.api('/'+pageId+'/feed', 'post', post);
  15. 15. Facebook Apps: Entwicklungsleitfaden Wallpost (PHP Style) <?php $pageId = 12345678; $post = array( 'message' => '', 'name' => 'Der Name des Links', 'caption' => 'Die Beschreibung', 'link' => 'http://www.facebook.com/'.$pageId, 'attribution' => 'Meine App' ); $facebook->api('/'.$pageId.'/feed', 'post', $post);
  16. 16. Facebook Apps: Entwicklungsleitfaden FQL enables you to use a SQL-style interface to query the data exposed by the Graph API.
  17. 17. Facebook Apps: Entwicklungsleitfaden FQL (JS Style) FB.api({ method: 'fql.query', query: 'select first_name,last_name,email from user where uid = me()' }, function(response) { console.log(response); });
  18. 18. Facebook Apps: Entwicklungsleitfaden FQL (JS Style) - Subselect FB.api({ method: 'fql.query', query: 'select first_name,last_name,email from user where uid IN (SELECT uid2 FROM friend WHERE uid1 = me())' }, function(response) { console.log(response); });
  19. 19. Vielen Dank!

×