SlideShare a Scribd company logo
1 of 50
Download to read offline
Facebook für (PHP) Entwickler
Facebook für (PHP) Entwickler

 Über mich

  Stephan Hochdörfer, bitExpert AG
  Department Manager Research Labs
  S.Hochdoerfer@bitExpert.de
  @shochdoerfer
  http://www.facebook.com/shochdoerfer
Facebook für (PHP) Entwickler

 Facebook Fakten

  Mehr als 800 Millionen aktive User
  Mehr als 900 Millionen Objekte (Pages, Gruppen, Events,...)
  ~20 Millionen Apps werden pro Tag installiert
  Pro Monat nutzen mehr als 500 Millionen User FB Apps
  ~350 Millionen User mit mobilen Clients




 Quelle: https://www.facebook.com/press/info.php?statistics
Facebook für (PHP) Entwickler




      Was kann der Entwickler nutzen?
Facebook für (PHP) Entwickler




 Social Plugins
Facebook für (PHP) Entwickler

 Facebook Social Plugins – Like Button
 <div id="fb-root"></div>
 <script>(function(d, s, id) {
   var js, fjs = d.getElementsByTagName(s)[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement(s); js.id = id;
   js.src =
 "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=0815";
   fjs.parentNode.insertBefore(js, fjs);
 }(document, 'script', 'facebook-jssdk'));</script>


 <div class="fb-like" data-href="http://www.phpugffm.de" data-
 send="false" data-width="450" data-show-faces="true"></div>
Facebook für (PHP) Entwickler




 Mobile Applikationen
Facebook für (PHP) Entwickler




 Facebook Applikationen
Facebook Apps: Entwicklungsleitfaden




 Canvas Applikation
Facebook Apps: Entwicklungsleitfaden




 Seitenreiter Applikation
Facebook für (PHP) Entwickler

 Die erste Facebook Applikation




                    Wie geht es los?
Facebook für (PHP) Entwickler




 http://developers.facebook.com
Facebook für (PHP) Entwickler




 http://developers.facebook.com/apps
Facebook für (PHP) Entwickler
Facebook für (PHP) Entwickler
Facebook für (PHP) Entwickler
Facebook für (PHP) Entwickler

 Facebook PHP SDK




    https://github.com/facebook/php-sdk
Facebook für (PHP) Entwickler

 Facebook PHP SDK
 <?php
 require '../lib/facebook/facebook.php';

 $facebook = new Facebook(array(
   'appId' => 'YOUR_APP_ID',
   'secret' => 'YOUR_APP_SECRET',
 ));

 // Get User ID
 $user = $facebook->getUser();
Facebook für (PHP) Entwickler

 Facebook PHP SDK




                   Kein PSR-0? WTF?
Facebook für (PHP) Entwickler

 Facebook PHP SDK – PSR-0 work-a-round
 <?php
 require_once(__DIR__.'/facebook.php');


 /**
  * Facebook client, PSR-0 style
  */


 class Facebook_Client extends Facebook
 {
 }
Facebook für (PHP) Entwickler

 Facebook PHP SDK – PSR-0 work-a-round
 <?php

 $facebook = new Facebook_Client(array(
   'appId' => 'YOUR_APP_ID',
   'secret' => 'YOUR_APP_SECRET',
 ));

 // Get User ID
 $user = $facebook->getUser();
Facebook für (PHP) Entwickler

 Die erste Facebook App
 <!DOCTYPE html>
 <html>
 <body>
 <div id="fb-root"></div>
 <script type="text/javascript">
 window.fbAsyncInit = function() {
      FB.init({
          appId: 'YOUR_APP_ID', status: true, cookie: true, xfbml: true, oauth:
 true
      });
 };
 (function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) {return;}
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=YOUR_APP_ID";
      fjs.parentNode.insertBefore(js, fjs);
 }(document, 'script', 'facebook-jssdk'));
 </script>
 <div class="wrapper"></div>
 </body>
 </html>
Facebook für (PHP) Entwickler

 Die erste Facebook App
 <!DOCTYPE html>
 <html>
 <body>
 <div id="fb-root"></div>
 <script type="text/javascript">
 window.fbAsyncInit = function() {
      FB.init({
          appId: 'YOUR_APP_ID', status: true, cookie: true, xfbml: true, oauth:
 true
      });
 };
 (function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) {return;}
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=YOUR_APP_ID";
      fjs.parentNode.insertBefore(js, fjs);
 }(document, 'script', 'facebook-jssdk'));
 </script>
 <div class="wrapper"></div>
 </body>
 </html>
Facebook für (PHP) Entwickler

 Die erste Facebook App
 <!DOCTYPE html>
 <html>
 <body>
 <div id="fb-root"></div>
 <script type="text/javascript">
 window.fbAsyncInit = function() {
      FB.init({
          appId: 'YOUR_APP_ID', status: true, cookie: true, xfbml: true, oauth:
 true
      });
 };
 (function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) {return;}
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=YOUR_APP_ID";
      fjs.parentNode.insertBefore(js, fjs);
 }(document, 'script', 'facebook-jssdk'));
 </script>
 <div class="wrapper"></div>
 </body>
 </html>
Facebook für (PHP) Entwickler

 Die erste Facebook App
 <!DOCTYPE html>
 <html>
 <body>
 <div id="fb-root"></div>
 <script type="text/javascript">
 window.fbAsyncInit = function() {
      FB.init({
          appId: 'YOUR_APP_ID', status: true, cookie: true, xfbml: true, oauth:
 true
      });
 };
 (function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) {return;}
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=YOUR_APP_ID";
      fjs.parentNode.insertBefore(js, fjs);
 }(document, 'script', 'facebook-jssdk'));
 </script>
 <div class="wrapper"></div>
 </body>
 </html>
Facebook für (PHP) Entwickler

 Die erste Facebook App




    Wie kommt die App auf die Fanpage?
Facebook für (PHP) Entwickler

 Die erste Facebook App – Fanpage Integration




https://www.facebook.com/dialog/pagetab
?app_id=YOUR_APP_ID&next=YOUR_URL
Facebook für (PHP) Entwickler

 Die erste Facebook App – Fanpage Integration
Facebook Apps: Entwicklungsleitfaden




 Fertig :)
Facebook für (PHP) Entwickler

 Request Flow


                                       HTTP Post Request
                                       + signed_request

         User /             Facebook                Applikations-
        Browser              Fanpage                  server
Facebook für (PHP) Entwickler

 Request Flow - signed_request

  sicherer Datenaustausch zw. Facebook und der eigenen
  App
  Konkatenation HMAC SHA-256 Signatur, einem Punkt (.)
  und einem base64 kodierten JSON Objekt
  Zum Dekodieren wird das App Secret benötigt!
  Enthält Informationen zum User, Fanpage und Deeplink
  Parameter
Facebook für (PHP) Entwickler




 Wer ist der User?
Facebook für (PHP) Entwickler

 Login / Authentifzierung
 FB.getLoginStatus(function(response) {
       if (response.authResponse) {
           // User eingeloggt
       } else {
           // Versuchen den User einzuloggen
           FB.login(function(response) {
                if(response.authResponse) {
                    if(response.perms) {
                         // ist eingeloggt....
                    }
                }
           }, {
                perms: 'publish_stream, offline_access'
           });
       }
 });
Facebook für (PHP) Entwickler

 Login / Authentifzierung – Signed Request




  Neuer signed_request nach dem Login!
Facebook für (PHP) Entwickler

 Login / Authentifzierung – User Perms

 user_about_me, user_activities, user_birthday,
 user_checkins, user_education_history, user_events,
 user_groups, user_hometown, user_interests, user_likes,
 user_location, user_notes, user_online_presence,
 user_photo_video_tags, user_photos, user_questions,
 user_relationships, user_relationships_details,
 user_religion_politics, user_status, user_videos,
 user_website, user_work_history, email
Facebook für (PHP) Entwickler

 Login / Authentifzierung – Extended Perms

 read_friendlists, read_insights, read_mailbox,
 read_requests, read_stream, xmpp_login,
 ads_management, create_event, manage_friendlists,
 manage_notifications, offline_access, publish_checkins,
 publish_stream, rsvp_event, sms, publish_actions,
 manage_pages
Facebook für (PHP) Entwickler




   The Graph API presents a simple,
 consistent view of the Facebook social
graph, uniformly representing objects in
the graph and the connections between
                 them.
Facebook für (PHP) Entwickler

 Graph API – Wer bin ich?




      https://graph.facebook.com/me?
               access_token=
Facebook für (PHP) Entwickler

 Graph API – Wer sind meine Freunde?




https://graph.facebook.com/me/friends?
             access_token=
Facebook für (PHP) Entwickler

 Graph API – Was mag ich?




  https://graph.facebook.com/me/likes?
              access_token=
Facebook für (PHP) Entwickler

 Graph API (JS Style)
 FB.api('/me', function(response) {
   alert(response.name);
 });
Facebook für (PHP) Entwickler

 Graph API (JS Style)
 var msg = 'Hello phpugffm!';

 FB.api('/me/feed', 'post', { message: msg }, function(response) {
   if (!response || response.error) {
     alert('Error occured');
   } else {
     alert('Post ID: ' + response.id);
   }
 });
Facebook für (PHP) Entwickler

 Graph API (PHP Style)
 <?php

 $post = array(
     'message' => 'Hello phpugffm!',
 );

 $facebook->api('/me/feed', 'post', $post);
Facebook für (PHP) Entwickler




    FQL enables you to use a SQL-style
  interface to query the data exposed by
               the Graph API.
Facebook für (PHP) Entwickler

 FQL Tabellen

album, application, apprequest, checkin, comment,
comments_info, connection, cookies, developer, domain,
domain_admin, event, event_member, family, friend,
friend_request, friendlist, friendlist_member, group,
group_member, insights, like, link, link_stat, mailbox_folder,
message, note, notification, object_url, page, page_admin,
page_blocked_user, page_fan, permissions,
permissions_info, photo, photo_tag, place, privacy,
privacy_setting, profile, question, question_option,
question_option_votes, review, standard_friend_info,
standard_user_info, status, stream, stream_filter,
stream_tag, thread, translation, unified_thread,
unified_thread_action, user, ...
Facebook für (PHP) Entwickler

 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);
 });
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);
 });
Facebook für (PHP) Entwickler

 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);
Facebook für (PHP) Entwickler

 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);
Vielen Dank!

More Related Content

Viewers also liked (9)

Simplify your external dependency management - DPC11
Simplify your external dependency management - DPC11Simplify your external dependency management - DPC11
Simplify your external dependency management - DPC11
 
Testing untestable code - PHPUGFFM 01/11
Testing untestable code - PHPUGFFM 01/11Testing untestable code - PHPUGFFM 01/11
Testing untestable code - PHPUGFFM 01/11
 
Testing untestable code - STPCon11
Testing untestable code - STPCon11Testing untestable code - STPCon11
Testing untestable code - STPCon11
 
Testing untestable code - Herbstcampus12
Testing untestable code - Herbstcampus12Testing untestable code - Herbstcampus12
Testing untestable code - Herbstcampus12
 
Testing untestable code - phpconpl11
Testing untestable code - phpconpl11Testing untestable code - phpconpl11
Testing untestable code - phpconpl11
 
Offline Strategies for HTML5 Web Applications - ipc13
Offline Strategies for HTML5 Web Applications - ipc13Offline Strategies for HTML5 Web Applications - ipc13
Offline Strategies for HTML5 Web Applications - ipc13
 
How to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring EditionHow to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring Edition
 
Phing for power users - frOSCon8
Phing for power users - frOSCon8Phing for power users - frOSCon8
Phing for power users - frOSCon8
 
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
 

Similar to Facebook für PHP Entwickler - phpugffm

OAuth Introduction
OAuth IntroductionOAuth Introduction
OAuth Introduction
h_marvin
 
Facebook API
Facebook APIFacebook API
Facebook API
snipermkd
 
Hi5 Hackathon Presentation
Hi5 Hackathon PresentationHi5 Hackathon Presentation
Hi5 Hackathon Presentation
Lou Moore
 

Similar to Facebook für PHP Entwickler - phpugffm (20)

Foundations of a Social Application Platform
Foundations of a Social Application PlatformFoundations of a Social Application Platform
Foundations of a Social Application Platform
 
Workshop : Facebook JavaScript SDK
Workshop : Facebook JavaScript SDKWorkshop : Facebook JavaScript SDK
Workshop : Facebook JavaScript SDK
 
Facebook Connect Integration
Facebook Connect IntegrationFacebook Connect Integration
Facebook Connect Integration
 
OAuth Introduction
OAuth IntroductionOAuth Introduction
OAuth Introduction
 
The Face Behind Facebook
The Face Behind FacebookThe Face Behind Facebook
The Face Behind Facebook
 
Facebook Connect
Facebook ConnectFacebook Connect
Facebook Connect
 
Hi5 Open Social
Hi5   Open SocialHi5   Open Social
Hi5 Open Social
 
Leveraging Rails to Build Facebook Apps
Leveraging Rails to Build Facebook AppsLeveraging Rails to Build Facebook Apps
Leveraging Rails to Build Facebook Apps
 
The social media developer
The social media developer The social media developer
The social media developer
 
Shiny Agency's Facebook Development Guidelines
Shiny Agency's Facebook Development GuidelinesShiny Agency's Facebook Development Guidelines
Shiny Agency's Facebook Development Guidelines
 
fb-researchの舞台裏No.2~技術編~(HatchUp主催 渋谷Facebookアプリ勉強会)
fb-researchの舞台裏No.2~技術編~(HatchUp主催 渋谷Facebookアプリ勉強会)fb-researchの舞台裏No.2~技術編~(HatchUp主催 渋谷Facebookアプリ勉強会)
fb-researchの舞台裏No.2~技術編~(HatchUp主催 渋谷Facebookアプリ勉強会)
 
Facebook api
Facebook api Facebook api
Facebook api
 
Facebook API
Facebook APIFacebook API
Facebook API
 
23 FACEBOOK APP DEVELOPMENT ESSENTIALS
23 FACEBOOK APP DEVELOPMENT ESSENTIALS23 FACEBOOK APP DEVELOPMENT ESSENTIALS
23 FACEBOOK APP DEVELOPMENT ESSENTIALS
 
Creating a Facebook App
Creating a Facebook AppCreating a Facebook App
Creating a Facebook App
 
Foundational Facebook Marketing
Foundational Facebook MarketingFoundational Facebook Marketing
Foundational Facebook Marketing
 
Open Hack Day Bangalore: Hacking Yahoo! Social
Open Hack Day Bangalore: Hacking Yahoo! SocialOpen Hack Day Bangalore: Hacking Yahoo! Social
Open Hack Day Bangalore: Hacking Yahoo! Social
 
Hi5 Hackathon Presentation
Hi5 Hackathon PresentationHi5 Hackathon Presentation
Hi5 Hackathon Presentation
 
Facebook Apps Development 101 (Java)
Facebook Apps Development 101 (Java)Facebook Apps Development 101 (Java)
Facebook Apps Development 101 (Java)
 
Guia de Sobrevivência JS no mundo Open Source
Guia de Sobrevivência JS no mundo Open SourceGuia de Sobrevivência JS no mundo Open Source
Guia de Sobrevivência JS no mundo Open Source
 

More from Stephan Hochdörfer

Offline. Na und? Strategien für offlinefähige Applikationen in HTML5 - Herbst...
Offline. Na und? Strategien für offlinefähige Applikationen in HTML5 - Herbst...Offline. Na und? Strategien für offlinefähige Applikationen in HTML5 - Herbst...
Offline. Na und? Strategien für offlinefähige Applikationen in HTML5 - Herbst...
Stephan Hochdörfer
 
Offline strategies for HTML5 web applications - frOSCon8
Offline strategies for HTML5 web applications - frOSCon8Offline strategies for HTML5 web applications - frOSCon8
Offline strategies for HTML5 web applications - frOSCon8
Stephan Hochdörfer
 
Offline Strategies for HTML5 Web Applications - oscon13
Offline Strategies for HTML5 Web Applications - oscon13Offline Strategies for HTML5 Web Applications - oscon13
Offline Strategies for HTML5 Web Applications - oscon13
Stephan Hochdörfer
 
Real World Dependency Injection - oscon13
Real World Dependency Injection - oscon13Real World Dependency Injection - oscon13
Real World Dependency Injection - oscon13
Stephan Hochdörfer
 
Dependency Injection in PHP - dwx13
Dependency Injection in PHP - dwx13Dependency Injection in PHP - dwx13
Dependency Injection in PHP - dwx13
Stephan Hochdörfer
 
Offline Strategien für HTML5 Web Applikationen - dwx13
Offline Strategien für HTML5 Web Applikationen - dwx13 Offline Strategien für HTML5 Web Applikationen - dwx13
Offline Strategien für HTML5 Web Applikationen - dwx13
Stephan Hochdörfer
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13
Stephan Hochdörfer
 
Phing for power users - dpc_uncon13
Phing for power users - dpc_uncon13Phing for power users - dpc_uncon13
Phing for power users - dpc_uncon13
Stephan Hochdörfer
 
Offline-Strategien für HTML5 Web Applikationen - wmka
Offline-Strategien für HTML5 Web Applikationen - wmkaOffline-Strategien für HTML5 Web Applikationen - wmka
Offline-Strategien für HTML5 Web Applikationen - wmka
Stephan Hochdörfer
 
Offline-Strategien für HTML5 Web Applikationen - bedcon13
Offline-Strategien für HTML5 Web Applikationen - bedcon13Offline-Strategien für HTML5 Web Applikationen - bedcon13
Offline-Strategien für HTML5 Web Applikationen - bedcon13
Stephan Hochdörfer
 
Real World Dependency Injection - phpugffm13
Real World Dependency Injection - phpugffm13Real World Dependency Injection - phpugffm13
Real World Dependency Injection - phpugffm13
Stephan Hochdörfer
 
Testing untestable code - ConFoo13
Testing untestable code - ConFoo13Testing untestable code - ConFoo13
Testing untestable code - ConFoo13
Stephan Hochdörfer
 
Offline strategies for HTML5 web applications - ConFoo13
Offline strategies for HTML5 web applications - ConFoo13Offline strategies for HTML5 web applications - ConFoo13
Offline strategies for HTML5 web applications - ConFoo13
Stephan Hochdörfer
 
Offline-Strategien für HTML5Web Applikationen - WMMRN12
Offline-Strategien für HTML5Web Applikationen - WMMRN12Offline-Strategien für HTML5Web Applikationen - WMMRN12
Offline-Strategien für HTML5Web Applikationen - WMMRN12
Stephan Hochdörfer
 
Offline strategies for HTML5 web applications - IPC12
Offline strategies for HTML5 web applications - IPC12Offline strategies for HTML5 web applications - IPC12
Offline strategies for HTML5 web applications - IPC12
Stephan Hochdörfer
 
Große Systeme, lose Kopplung, Spaß bei der Arbeit! - WDC12
Große Systeme, lose Kopplung, Spaß bei der Arbeit! - WDC12Große Systeme, lose Kopplung, Spaß bei der Arbeit! - WDC12
Große Systeme, lose Kopplung, Spaß bei der Arbeit! - WDC12
Stephan Hochdörfer
 
Offline strategies for HTML5 web applications - pfCongres2012
Offline strategies for HTML5 web applications - pfCongres2012Offline strategies for HTML5 web applications - pfCongres2012
Offline strategies for HTML5 web applications - pfCongres2012
Stephan Hochdörfer
 
Wie Software-Generatoren die Welt verändern können - Herbstcampus12
Wie Software-Generatoren die Welt verändern können - Herbstcampus12Wie Software-Generatoren die Welt verändern können - Herbstcampus12
Wie Software-Generatoren die Welt verändern können - Herbstcampus12
Stephan Hochdörfer
 

More from Stephan Hochdörfer (20)

Offline. Na und? Strategien für offlinefähige Applikationen in HTML5 - Herbst...
Offline. Na und? Strategien für offlinefähige Applikationen in HTML5 - Herbst...Offline. Na und? Strategien für offlinefähige Applikationen in HTML5 - Herbst...
Offline. Na und? Strategien für offlinefähige Applikationen in HTML5 - Herbst...
 
Offline strategies for HTML5 web applications - frOSCon8
Offline strategies for HTML5 web applications - frOSCon8Offline strategies for HTML5 web applications - frOSCon8
Offline strategies for HTML5 web applications - frOSCon8
 
Offline Strategies for HTML5 Web Applications - oscon13
Offline Strategies for HTML5 Web Applications - oscon13Offline Strategies for HTML5 Web Applications - oscon13
Offline Strategies for HTML5 Web Applications - oscon13
 
Real World Dependency Injection - oscon13
Real World Dependency Injection - oscon13Real World Dependency Injection - oscon13
Real World Dependency Injection - oscon13
 
Dependency Injection in PHP - dwx13
Dependency Injection in PHP - dwx13Dependency Injection in PHP - dwx13
Dependency Injection in PHP - dwx13
 
Offline Strategien für HTML5 Web Applikationen - dwx13
Offline Strategien für HTML5 Web Applikationen - dwx13 Offline Strategien für HTML5 Web Applikationen - dwx13
Offline Strategien für HTML5 Web Applikationen - dwx13
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13
 
Phing for power users - dpc_uncon13
Phing for power users - dpc_uncon13Phing for power users - dpc_uncon13
Phing for power users - dpc_uncon13
 
Offline-Strategien für HTML5 Web Applikationen - wmka
Offline-Strategien für HTML5 Web Applikationen - wmkaOffline-Strategien für HTML5 Web Applikationen - wmka
Offline-Strategien für HTML5 Web Applikationen - wmka
 
Offline-Strategien für HTML5 Web Applikationen - bedcon13
Offline-Strategien für HTML5 Web Applikationen - bedcon13Offline-Strategien für HTML5 Web Applikationen - bedcon13
Offline-Strategien für HTML5 Web Applikationen - bedcon13
 
Real World Dependency Injection - phpugffm13
Real World Dependency Injection - phpugffm13Real World Dependency Injection - phpugffm13
Real World Dependency Injection - phpugffm13
 
Testing untestable code - ConFoo13
Testing untestable code - ConFoo13Testing untestable code - ConFoo13
Testing untestable code - ConFoo13
 
A Phing fairy tale - ConFoo13
A Phing fairy tale - ConFoo13A Phing fairy tale - ConFoo13
A Phing fairy tale - ConFoo13
 
Offline strategies for HTML5 web applications - ConFoo13
Offline strategies for HTML5 web applications - ConFoo13Offline strategies for HTML5 web applications - ConFoo13
Offline strategies for HTML5 web applications - ConFoo13
 
Offline-Strategien für HTML5Web Applikationen - WMMRN12
Offline-Strategien für HTML5Web Applikationen - WMMRN12Offline-Strategien für HTML5Web Applikationen - WMMRN12
Offline-Strategien für HTML5Web Applikationen - WMMRN12
 
Testing untestable code - IPC12
Testing untestable code - IPC12Testing untestable code - IPC12
Testing untestable code - IPC12
 
Offline strategies for HTML5 web applications - IPC12
Offline strategies for HTML5 web applications - IPC12Offline strategies for HTML5 web applications - IPC12
Offline strategies for HTML5 web applications - IPC12
 
Große Systeme, lose Kopplung, Spaß bei der Arbeit! - WDC12
Große Systeme, lose Kopplung, Spaß bei der Arbeit! - WDC12Große Systeme, lose Kopplung, Spaß bei der Arbeit! - WDC12
Große Systeme, lose Kopplung, Spaß bei der Arbeit! - WDC12
 
Offline strategies for HTML5 web applications - pfCongres2012
Offline strategies for HTML5 web applications - pfCongres2012Offline strategies for HTML5 web applications - pfCongres2012
Offline strategies for HTML5 web applications - pfCongres2012
 
Wie Software-Generatoren die Welt verändern können - Herbstcampus12
Wie Software-Generatoren die Welt verändern können - Herbstcampus12Wie Software-Generatoren die Welt verändern können - Herbstcampus12
Wie Software-Generatoren die Welt verändern können - Herbstcampus12
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Facebook für PHP Entwickler - phpugffm

  • 1. Facebook für (PHP) Entwickler
  • 2. Facebook für (PHP) Entwickler Über mich  Stephan Hochdörfer, bitExpert AG  Department Manager Research Labs  S.Hochdoerfer@bitExpert.de  @shochdoerfer  http://www.facebook.com/shochdoerfer
  • 3. Facebook für (PHP) Entwickler Facebook Fakten  Mehr als 800 Millionen aktive User  Mehr als 900 Millionen Objekte (Pages, Gruppen, Events,...)  ~20 Millionen Apps werden pro Tag installiert  Pro Monat nutzen mehr als 500 Millionen User FB Apps  ~350 Millionen User mit mobilen Clients Quelle: https://www.facebook.com/press/info.php?statistics
  • 4. Facebook für (PHP) Entwickler Was kann der Entwickler nutzen?
  • 5. Facebook für (PHP) Entwickler Social Plugins
  • 6. Facebook für (PHP) Entwickler Facebook Social Plugins – Like Button <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=0815"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-like" data-href="http://www.phpugffm.de" data- send="false" data-width="450" data-show-faces="true"></div>
  • 7. Facebook für (PHP) Entwickler Mobile Applikationen
  • 8. Facebook für (PHP) Entwickler Facebook Applikationen
  • 10. Facebook Apps: Entwicklungsleitfaden Seitenreiter Applikation
  • 11. Facebook für (PHP) Entwickler Die erste Facebook Applikation Wie geht es los?
  • 12. Facebook für (PHP) Entwickler http://developers.facebook.com
  • 13. Facebook für (PHP) Entwickler http://developers.facebook.com/apps
  • 14. Facebook für (PHP) Entwickler
  • 15. Facebook für (PHP) Entwickler
  • 16. Facebook für (PHP) Entwickler
  • 17. Facebook für (PHP) Entwickler Facebook PHP SDK https://github.com/facebook/php-sdk
  • 18. Facebook für (PHP) Entwickler Facebook PHP SDK <?php require '../lib/facebook/facebook.php'; $facebook = new Facebook(array( 'appId' => 'YOUR_APP_ID', 'secret' => 'YOUR_APP_SECRET', )); // Get User ID $user = $facebook->getUser();
  • 19. Facebook für (PHP) Entwickler Facebook PHP SDK Kein PSR-0? WTF?
  • 20. Facebook für (PHP) Entwickler Facebook PHP SDK – PSR-0 work-a-round <?php require_once(__DIR__.'/facebook.php'); /** * Facebook client, PSR-0 style */ class Facebook_Client extends Facebook { }
  • 21. Facebook für (PHP) Entwickler Facebook PHP SDK – PSR-0 work-a-round <?php $facebook = new Facebook_Client(array( 'appId' => 'YOUR_APP_ID', 'secret' => 'YOUR_APP_SECRET', )); // Get User ID $user = $facebook->getUser();
  • 22. Facebook für (PHP) Entwickler Die erste Facebook App <!DOCTYPE html> <html> <body> <div id="fb-root"></div> <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({ appId: 'YOUR_APP_ID', status: true, cookie: true, xfbml: true, oauth: true }); }; (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=YOUR_APP_ID"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <div class="wrapper"></div> </body> </html>
  • 23. Facebook für (PHP) Entwickler Die erste Facebook App <!DOCTYPE html> <html> <body> <div id="fb-root"></div> <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({ appId: 'YOUR_APP_ID', status: true, cookie: true, xfbml: true, oauth: true }); }; (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=YOUR_APP_ID"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <div class="wrapper"></div> </body> </html>
  • 24. Facebook für (PHP) Entwickler Die erste Facebook App <!DOCTYPE html> <html> <body> <div id="fb-root"></div> <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({ appId: 'YOUR_APP_ID', status: true, cookie: true, xfbml: true, oauth: true }); }; (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=YOUR_APP_ID"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <div class="wrapper"></div> </body> </html>
  • 25. Facebook für (PHP) Entwickler Die erste Facebook App <!DOCTYPE html> <html> <body> <div id="fb-root"></div> <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({ appId: 'YOUR_APP_ID', status: true, cookie: true, xfbml: true, oauth: true }); }; (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=YOUR_APP_ID"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <div class="wrapper"></div> </body> </html>
  • 26. Facebook für (PHP) Entwickler Die erste Facebook App Wie kommt die App auf die Fanpage?
  • 27. Facebook für (PHP) Entwickler Die erste Facebook App – Fanpage Integration https://www.facebook.com/dialog/pagetab ?app_id=YOUR_APP_ID&next=YOUR_URL
  • 28. Facebook für (PHP) Entwickler Die erste Facebook App – Fanpage Integration
  • 30. Facebook für (PHP) Entwickler Request Flow HTTP Post Request + signed_request User / Facebook Applikations- Browser Fanpage server
  • 31. Facebook für (PHP) Entwickler Request Flow - signed_request  sicherer Datenaustausch zw. Facebook und der eigenen App  Konkatenation HMAC SHA-256 Signatur, einem Punkt (.) und einem base64 kodierten JSON Objekt  Zum Dekodieren wird das App Secret benötigt!  Enthält Informationen zum User, Fanpage und Deeplink Parameter
  • 32. Facebook für (PHP) Entwickler Wer ist der User?
  • 33. Facebook für (PHP) Entwickler Login / Authentifzierung FB.getLoginStatus(function(response) { if (response.authResponse) { // User eingeloggt } else { // Versuchen den User einzuloggen FB.login(function(response) { if(response.authResponse) { if(response.perms) { // ist eingeloggt.... } } }, { perms: 'publish_stream, offline_access' }); } });
  • 34. Facebook für (PHP) Entwickler Login / Authentifzierung – Signed Request Neuer signed_request nach dem Login!
  • 35. Facebook für (PHP) Entwickler Login / Authentifzierung – User Perms user_about_me, user_activities, user_birthday, user_checkins, user_education_history, user_events, user_groups, user_hometown, user_interests, user_likes, user_location, user_notes, user_online_presence, user_photo_video_tags, user_photos, user_questions, user_relationships, user_relationships_details, user_religion_politics, user_status, user_videos, user_website, user_work_history, email
  • 36. Facebook für (PHP) Entwickler Login / Authentifzierung – Extended Perms read_friendlists, read_insights, read_mailbox, read_requests, read_stream, xmpp_login, ads_management, create_event, manage_friendlists, manage_notifications, offline_access, publish_checkins, publish_stream, rsvp_event, sms, publish_actions, manage_pages
  • 37. Facebook für (PHP) Entwickler The Graph API presents a simple, consistent view of the Facebook social graph, uniformly representing objects in the graph and the connections between them.
  • 38. Facebook für (PHP) Entwickler Graph API – Wer bin ich? https://graph.facebook.com/me? access_token=
  • 39. Facebook für (PHP) Entwickler Graph API – Wer sind meine Freunde? https://graph.facebook.com/me/friends? access_token=
  • 40. Facebook für (PHP) Entwickler Graph API – Was mag ich? https://graph.facebook.com/me/likes? access_token=
  • 41. Facebook für (PHP) Entwickler Graph API (JS Style) FB.api('/me', function(response) { alert(response.name); });
  • 42. Facebook für (PHP) Entwickler Graph API (JS Style) var msg = 'Hello phpugffm!'; FB.api('/me/feed', 'post', { message: msg }, function(response) { if (!response || response.error) { alert('Error occured'); } else { alert('Post ID: ' + response.id); } });
  • 43. Facebook für (PHP) Entwickler Graph API (PHP Style) <?php $post = array( 'message' => 'Hello phpugffm!', ); $facebook->api('/me/feed', 'post', $post);
  • 44. Facebook für (PHP) Entwickler FQL enables you to use a SQL-style interface to query the data exposed by the Graph API.
  • 45. Facebook für (PHP) Entwickler FQL Tabellen album, application, apprequest, checkin, comment, comments_info, connection, cookies, developer, domain, domain_admin, event, event_member, family, friend, friend_request, friendlist, friendlist_member, group, group_member, insights, like, link, link_stat, mailbox_folder, message, note, notification, object_url, page, page_admin, page_blocked_user, page_fan, permissions, permissions_info, photo, photo_tag, place, privacy, privacy_setting, profile, question, question_option, question_option_votes, review, standard_friend_info, standard_user_info, status, stream, stream_filter, stream_tag, thread, translation, unified_thread, unified_thread_action, user, ...
  • 46. Facebook für (PHP) Entwickler 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); });
  • 47. 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); });
  • 48. Facebook für (PHP) Entwickler 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);
  • 49. Facebook für (PHP) Entwickler 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);