I am getting the following error with some code that I am using. The error is
[Mon Jun 27 16:44:04 2011] [error]
[client 194.116.198.179] PHP Fatal
error: Call to a member function
api() on a non-object in
/public_html/users/fbmain.php on line
89
The code I am using worked ok before I made it into a function. Line 89 begins with $statusUpdate.
function post_basic_status($msg){
try {
$statusUpdate = $facebook->api("/$user/feed", 'post', array('message'=> $msg));
} catch (FacebookApiException $e) {
d($e);
}
}
From looking online I cannot find any solution to this. IS there anything glaringly wrong with this
I’ve had the same issue… until your post about calling the api from a function.
It turns our that Facebook API doesn’t like to be used in a function.
It needs to be called on page load.