誰認識誰、多久聯繫一次、交流多少程度是相對的、最沈默與健談是誰、具影響力與人氣高是誰、大家正在聊什麼
本書的大部份程式都使用python
前面幾章分別介紹近年來受歡迎的社群媒體,臉書放在最後一部分,先看臉書吧
第九章 一體化的奇蹟
先從臉書的API開始,首先的利用OAuth取得權限,接著就進行資料收集,部分程式需要放到GAE,剛好是最近學的。
首先要設定臉書的開發者授權,需要登入帳號及手機簡訊,先到www.facebook.com/developers點擊吧
接著申請一個新的APP,屬於facebook canvas型態的,然後出現
Setup the Facebook SDK for JavaScript
The following snippet of code will give the basic version of the SDK where the options are set to their most common defaults. You should insert it directly after the opening <body> tag on each page you want to load it:
<script> window.fbAsyncInit = function() { FB.init({ appId : '1109480392399840', xfbml : true, version : 'v2.4' }); // ADD ADDITIONAL FACEBOOK CODE HERE }; (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/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script>這段話是說,上面的代碼,必須放在你相關網頁的<boby>標籤之後
Where is your app hosted?
Canvas Page
This will be the Facebook URL for your app
Secure Host URL
Our servers will make an HTTP POST request to this web address. The retrieved result will displayed within the Canvas frame on Facebook.
上面要設定相關的網址Our servers will make an HTTP POST request to this web address是說facebook會post請求到你的網址,然後結果會秀在facebook canvas frame
沒有留言:
張貼留言