Fb-researchの舞台裏2       (技術編)          HatchUp CSO             @modeelf
fb-researchとは・・・facebookメッセージを一斉に送れるツールです
メッセージ送信数の推移                       5万2000件                       (3/15現在)  TechWave   男子ハック     掲載       掲載 あけおめ           ...
構成Ubuntu 11.10PHP+symfonyApache+MySQL+MongoDB+GoogleDocs
About EngineeringFacebookの提供している公式のSDK(PHP)はイケてない→自前でFacebook接続系をクラス化lib/FacebookUtil.class.php
About Engineeringlib/FacebookUtil.class.phpclass FacebookUtil { …  public function FacebookUtil() {   // config/custom.yml...
About Engineering
About Engineeringlib/FacebookUtil.class.php---core: facebook_key:   app_id: 012345678901234   app_secret: a1s2d3f4g5h6j7k8...
About EngineeringFacebookアプリキー設定管理画面
About Engineeringlib/FacebookUtil.class.php public function getOauthUrl() {  $oauth_url = http://www.facebook.com/dialog/o...
About Engineering    lib/FacebookUtil.class.phppublic function getMe() { if (empty($this->access_token)) $this->getAccessT...
about DesignHatchUpではデザイナを募集しています
about MonetizeFb-researchの仕組みを絶賛ASP(SaaS)形式で提供中!お問い合わせはinfo@hatchup.jpまで
Thank you for listening!
Upcoming SlideShare
Loading in …5
×

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

1,648 views
1,597 views

Published on

リリースから2ヶ月で約5万件のメッセージが送信されたFacebookメッセージグループ送信ツール「fb-research」についてこちら(http://atnd.org/events/24642)のイベントで講演しました。

fb-research:http://grow.pe/fbr/

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,648
On SlideShare
0
From Embeds
0
Number of Embeds
150
Actions
Shares
0
Downloads
1
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

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

  1. 1. Fb-researchの舞台裏2 (技術編) HatchUp CSO @modeelf
  2. 2. fb-researchとは・・・facebookメッセージを一斉に送れるツールです
  3. 3. メッセージ送信数の推移 5万2000件 (3/15現在) TechWave 男子ハック 掲載 掲載 あけおめ 4万件突破 メッセージ 3万件突破
  4. 4. 構成Ubuntu 11.10PHP+symfonyApache+MySQL+MongoDB+GoogleDocs
  5. 5. About EngineeringFacebookの提供している公式のSDK(PHP)はイケてない→自前でFacebook接続系をクラス化lib/FacebookUtil.class.php
  6. 6. About Engineeringlib/FacebookUtil.class.phpclass 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, ); ...
  7. 7. About Engineering
  8. 8. About Engineeringlib/FacebookUtil.class.php---core: facebook_key: app_id: 012345678901234 app_secret: a1s2d3f4g5h6j7k8l9hoge app_url: http://grow.pe/fbr/
  9. 9. About EngineeringFacebookアプリキー設定管理画面
  10. 10. About Engineeringlib/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]; } }
  11. 11. About Engineering lib/FacebookUtil.class.phppublic 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;}
  12. 12. about DesignHatchUpではデザイナを募集しています
  13. 13. about MonetizeFb-researchの仕組みを絶賛ASP(SaaS)形式で提供中!お問い合わせはinfo@hatchup.jpまで
  14. 14. Thank you for listening!

×