Fatal error: Call to a member function setAccessToken() on a non-object in

I'm getting:

Fatal error: Call to a member function setAccessToken() on a non-object in

In this line:

$fbObj->setAccessToken($token->access_token);

And this is the function:

public function setAccessToken($accessToken) { $this->accessToken = $accessToken; }

Where's the error?

Thanks a lot

-------------Problems Reply------------

It seems $fbObj is not properly initialized, where are you using this line?

If you are using it inside a method, and the $fbObj is defined in the global scope (i.e. you defined it in an include file) you should use global $fbObj at the start of the method.

create the object of class. $fbObj does not exists

$fbObj = new className();

it should be like that

// get facebook library

require_once 'library/facebook.php';

// Create our Application instance
//normally we use $facebook instead of $fbobj

$fbobj = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true,
));

thn do other works

Category:php Views:1 Time:2011-01-18
Tags: php

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.167 (s). 11 q(s)