SlideShare una empresa de Scribd logo
1 de 14
Descargar para leer sin conexión
Fb-researchの舞台裏2
       (技術編)


          HatchUp CSO
             @modeelf
fb-researchとは・・・




facebookメッセージを一斉に送れるツールです
メッセージ送信数の推移
                       5万2000件
                       (3/15現在)




  TechWave   男子ハック
     掲載       掲載


 あけおめ
                      4万件突破
 メッセージ
              3万件突破
構成


Ubuntu 11.10

PHP+symfony

Apache+MySQL+MongoDB+GoogleDocs
About Engineering


Facebookの提供している
公式のSDK(PHP)はイケてない

→自前でFacebook接続系をクラス化
lib/FacebookUtil.class.php
About Engineering
lib/FacebookUtil.class.php
class FacebookUtil {
 …
  public function FacebookUtil() {
   // config/custom.ymlからアプリキー取得
   $this->custom = Spyc::YAMLLoad('/path/to/project/config/custom.yml');
   $this->app_id = $this->custom['core']['facebook_key']['app_id'];
   $this->app_secret = $this->custom['core']['facebook_key']['app_secret'];

    $this->scope = array(
       'email',
       'read_stream',
       'xmpp_login',
       'offline_access', // 2012/02/20廃止
       'user_birthday',
       'user_work_history',
       'user_location',
       'user_likes',
       'user_education_history',
       'friends_birthday',
       'friends_work_history',
       'friends_location',
       'friends_likes',
       'friends_education_history',
    );
 ...
About Engineering
About Engineering
lib/FacebookUtil.class.php




---
core:
 facebook_key:
   app_id: 012345678901234
   app_secret: a1s2d3f4g5h6j7k8l9hoge
   app_url: http://grow.pe/fbr/
About Engineering

Facebookアプリキー設定管理画面
About Engineering
lib/FacebookUtil.class.php
 public function getOauthUrl() {
  $oauth_url = 'http://www.facebook.com/dialog/oauth?client_id='
      . $this->app_id . '&redirect_uri=' . urlencode($this->redirect_url)
      . '&scope=' . implode(',', $this->scope);

     return $oauth_url;
 }

 public function getAccessToken($code='') {
  if (empty($code)) {
    $this->access_token = sfContext::getInstance()->getUser()->get('user')->getFacebookToken();
  } else {
    $this->access_token = $code;
  }

     $token_url = 'https://graph.facebook.com/oauth/access_token?client_id='
       . $this->app_id . '&client_secret=' . $this->app_secret
       . '&redirect_uri=' . urlencode($this->redirect_url) . '&code=' . $code;
     $response = $this->crawler->curlCached($token_url, array('no_cache' => true));
     $arr = explode('=', $response);
     if (!empty($arr[1])) {
       $this->access_token = $arr[1];
     }
 }
About Engineering
    lib/FacebookUtil.class.php

public function getMe() {
 if (empty($this->access_token)) $this->getAccessToken();

    $graph_url = 'https://graph.facebook.com/me?access_token=' . $this->access_token;
    $this->me = json_decode($this->crawler->curlCached($graph_url));
}

public function getFriends($uid = '', $sub_query='') {
 if (empty($this->me)) $this->getMe();
 if (empty($uid)) $uid = $this->me->id;

    $fql = 'SELECT id, name FROM profile WHERE id IN (SELECT uid2 FROM friend WHERE uid1=' . $uid.')' . $sub_query;
    $graph_url = 'https://api.facebook.com/method/fql.query?query='
     . rawurlencode($fql) . '&access_token=' . $this->access_token.'&format=json';
    $friend_arr = json_decode($this->crawler->curlCached($graph_url));

    return $friend_arr;
}
about Design




HatchUpではデザイナを募集しています
about Monetize


Fb-researchの仕組みを
絶賛ASP(SaaS)形式で提供中!

お問い合わせはinfo@hatchup.jpまで
Thank you for listening!

Más contenido relacionado

La actualidad más candente

6.Conocimiento cliente Cuenta Pagos en Linea. (Interlat Group
6.Conocimiento cliente Cuenta Pagos en Linea. (Interlat Group6.Conocimiento cliente Cuenta Pagos en Linea. (Interlat Group
6.Conocimiento cliente Cuenta Pagos en Linea. (Interlat Group
Interlat
 
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Masashi Shibata
 
Essentials for Implementers Certificate
Essentials for Implementers CertificateEssentials for Implementers Certificate
Essentials for Implementers Certificate
Roberta Pereira
 

La actualidad más candente (19)

H4x0rs gonna hack
H4x0rs gonna hackH4x0rs gonna hack
H4x0rs gonna hack
 
TICT #13
TICT #13TICT #13
TICT #13
 
TICT #11
TICT #11 TICT #11
TICT #11
 
Alamat emotion
Alamat emotionAlamat emotion
Alamat emotion
 
Group prez search engines
Group prez search enginesGroup prez search engines
Group prez search engines
 
Magento Security from Developer's and Tester's Points of View
Magento Security from Developer's and Tester's Points of ViewMagento Security from Developer's and Tester's Points of View
Magento Security from Developer's and Tester's Points of View
 
6.Conocimiento cliente Cuenta Pagos en Linea. (Interlat Group
6.Conocimiento cliente Cuenta Pagos en Linea. (Interlat Group6.Conocimiento cliente Cuenta Pagos en Linea. (Interlat Group
6.Conocimiento cliente Cuenta Pagos en Linea. (Interlat Group
 
Migrare da symfony 1 a Symfony2
 Migrare da symfony 1 a Symfony2  Migrare da symfony 1 a Symfony2
Migrare da symfony 1 a Symfony2
 
17. CodeIgniter login simplu cu sesiuni
17. CodeIgniter login simplu cu sesiuni17. CodeIgniter login simplu cu sesiuni
17. CodeIgniter login simplu cu sesiuni
 
OWASP Top 10 at International PHP Conference 2014 in Berlin
OWASP Top 10 at International PHP Conference 2014 in BerlinOWASP Top 10 at International PHP Conference 2014 in Berlin
OWASP Top 10 at International PHP Conference 2014 in Berlin
 
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
 
SQL Injection in PHP
SQL Injection in PHPSQL Injection in PHP
SQL Injection in PHP
 
OWASP TOP 10 for PHP Programmers
OWASP TOP 10 for PHP ProgrammersOWASP TOP 10 for PHP Programmers
OWASP TOP 10 for PHP Programmers
 
FamilySearch Reference Client
FamilySearch Reference ClientFamilySearch Reference Client
FamilySearch Reference Client
 
Building scalable products with WordPress - WordCamp London 2018
Building scalable products with WordPress - WordCamp London 2018Building scalable products with WordPress - WordCamp London 2018
Building scalable products with WordPress - WordCamp London 2018
 
Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)
 
Essentials for Implementers Certificate
Essentials for Implementers CertificateEssentials for Implementers Certificate
Essentials for Implementers Certificate
 
Can WordPress really do that? A case study of vierderduer.no
Can WordPress really do that? A case study of vierderduer.noCan WordPress really do that? A case study of vierderduer.no
Can WordPress really do that? A case study of vierderduer.no
 
SQL so close I can paste it (YAPC::NA::2011 lightning talk)
SQL so close I can paste it (YAPC::NA::2011 lightning talk)SQL so close I can paste it (YAPC::NA::2011 lightning talk)
SQL so close I can paste it (YAPC::NA::2011 lightning talk)
 

Destacado

Destacado (7)

New York City
New York CityNew York City
New York City
 
6- Continuïtat en l'acompanyament. Mercè Riquelme
6- Continuïtat en l'acompanyament. Mercè Riquelme6- Continuïtat en l'acompanyament. Mercè Riquelme
6- Continuïtat en l'acompanyament. Mercè Riquelme
 
Ecological messages
Ecological messagesEcological messages
Ecological messages
 
Technet.microsoft.com
Technet.microsoft.comTechnet.microsoft.com
Technet.microsoft.com
 
Quin és el perfil d'un tutor? Josep-E Baños, rofessor de Medicina i ex vicer...
Quin és el perfil d'un tutor?  Josep-E Baños, rofessor de Medicina i ex vicer...Quin és el perfil d'un tutor?  Josep-E Baños, rofessor de Medicina i ex vicer...
Quin és el perfil d'un tutor? Josep-E Baños, rofessor de Medicina i ex vicer...
 
fb-researchの舞台裏No.1(HatchUp主催 渋谷Facebookアプリ勉強会)
fb-researchの舞台裏No.1(HatchUp主催 渋谷Facebookアプリ勉強会)fb-researchの舞台裏No.1(HatchUp主催 渋谷Facebookアプリ勉強会)
fb-researchの舞台裏No.1(HatchUp主催 渋谷Facebookアプリ勉強会)
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 

Similar a fb-researchの舞台裏No.2~技術編~(HatchUp主催 渋谷Facebookアプリ勉強会)

Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php framework
Bo-Yi Wu
 
Drupal 7 module development
Drupal 7 module developmentDrupal 7 module development
Drupal 7 module development
Adam Kalsey
 

Similar a fb-researchの舞台裏No.2~技術編~(HatchUp主催 渋谷Facebookアプリ勉強会) (20)

Curso Symfony - Clase 4
Curso Symfony - Clase 4Curso Symfony - Clase 4
Curso Symfony - Clase 4
 
Intro to Php Security
Intro to Php SecurityIntro to Php Security
Intro to Php Security
 
PhpBB meets Symfony2
PhpBB meets Symfony2PhpBB meets Symfony2
PhpBB meets Symfony2
 
Symfony2 - OSIDays 2010
Symfony2 - OSIDays 2010Symfony2 - OSIDays 2010
Symfony2 - OSIDays 2010
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
 
OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019
 
Php web backdoor obfuscation
Php web backdoor obfuscationPhp web backdoor obfuscation
Php web backdoor obfuscation
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php framework
 
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
 
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
 
Flutter Forward EXTENDED - Flutter로 앱 개발 입문하기
Flutter Forward EXTENDED -  Flutter로 앱 개발 입문하기Flutter Forward EXTENDED -  Flutter로 앱 개발 입문하기
Flutter Forward EXTENDED - Flutter로 앱 개발 입문하기
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJS
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
 
HTML::FormFu talk for Sydney PM
HTML::FormFu talk for Sydney PMHTML::FormFu talk for Sydney PM
HTML::FormFu talk for Sydney PM
 
Drupal 7 module development
Drupal 7 module developmentDrupal 7 module development
Drupal 7 module development
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Drupal campleuven: Secure Drupal Development
Drupal campleuven: Secure Drupal DevelopmentDrupal campleuven: Secure Drupal Development
Drupal campleuven: Secure Drupal Development
 
Hack and Slash: Secure Coding
Hack and Slash: Secure CodingHack and Slash: Secure Coding
Hack and Slash: Secure Coding
 
Perl web app 테스트전략
Perl web app 테스트전략Perl web app 테스트전략
Perl web app 테스트전략
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
 

Último

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 

Último (20)

Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 

fb-researchの舞台裏No.2~技術編~(HatchUp主催 渋谷Facebookアプリ勉強会)