0

I've searched a lot and know I need some help.

I must be missing something simple. I hope someone can point me a direction.

I found this code on the web:

class Example extends CI_Controller {

function __construct()
{
    parent::__construct();
}

function index()
{

    $fb_config = array(
        'appId'  => 'APPID',
        'secret' => 'SECRET'
    );

    $this->load->library('facebook', $fb_config);

    $user = $this->facebook->getUser();

    echo $user;


    if ($user) {
        try {
            $data['user_profile'] = $this->facebook->api('/me');
        } catch (FacebookApiException $e) {
            $user = null;
        }
    }

    if ($user) {
        $data['logout_url'] = $this->facebook->getLogoutUrl();
    } else {
        $data['login_url'] = $this->facebook->getLoginUrl();
    }


    $this->load->view('facebook',$data);
}

}

Because I never had the user info I decided to echo $user; and it is always 0. for that reason the script never enters the IF statements and I am stuck.

What am i missing?

The only things that append is the window refresh and the URL as some data there.

Thanks for any help.

Rui Ganga
  • 15
  • 3

0 Answers0