[eluser]Jerry Wu[/eluser]
1. Download the facebook client lib, and put the "facebook-platform" dir into /system/libraries/
here is the files in the path /system/libraries/facebook-platform/
facebook.php
facebook_mobile.php
facebook_desktop.php
facebookapi_php5_restlib.php
and sub-dir "jsonwrapper"
2. and then create /system/libraries/Facebook_client.php, this class load facebook client lib
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Facebook_client {
function __construct() {
require_once(BASEPATH . 'libraries/facebook-platform/' . 'facebook' . EXT);
}
}
?>
3. load the facebook_client library in your controller
Code:
class Demo extends Controller {
var $facebook;
function index(){
$this->load->library('facebook_client');
$this->facebook = new Facebook('xxx', 'xxx');
$this->facebook->require_frame();
$viewer_id = $this->facebook->require_login();
echo $viewer_id; //when you see your facebook uid, it works
}
}