2010年5月29日 星期六

FaceBook

1. 申請帳號: register your Facebook application.

2. 同意後,
應用程式 ID 103871759660058
API 金鑰 1c00525a36d8a201192d447927f6f06c 你公開的 API 金鑰。
秘密 ecbe6ca4855c667ff7ba8de9c460e3e7

3. 下載 facebook api 在 local 端.
取得 [Andy@t-ap188 MY_DIR]$ ls
facebookapi_php5_restlib.php facebook_mobile.php facebook.php 檔案

4, 建立應用程式: 在 local /MY_DIR/
index.php
{{{
// Copyright 2007 Facebook Corp. All Rights Reserved.
//
// Application: Example
// File: 'index.php'
// This is a sample skeleton for your application.
//

require_once 'facebook.php';

$appapikey = '0fb83bc6c1301371176a6bd1a05fbfb8';
$appsecret = 'b620c0cd71b8e1044534b50c90208a97';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();

// Greet the currently logged-in user!
echo "

Hello Hello, !

";

// Print out at most 25 of the logged-in user's friends,
// using the friends.get API method
echo "

Friends:";
$friends = $facebook->api_client->friends_get();
$friends = array_slice($friends, 0, 25);
foreach ($friends as $friend) {
echo "
$friend";
}
echo "

";

?>

}}}

}}}

5. 設定畫布 Canvas
1. 畫布頁面網址
http://apps.facebook.com/andyfacebookexample/
2. Canvas Callback URL -> http://140.109.98.188/MY_DIR/


6. 可以留覽應用程式

Reference:
1. http://developers.facebook.com/docs/guides/canvas/


Note:
1. 重點應該在 friend 應用
2. callback 作什麼呢??

沒有留言:

張貼留言