How to get the stream of a public Facebook fanpage in php?
- by Bundy
Hi,
I want to display my public fanpage feed onto my website via the Facebook API without requiring a login.
I'm doing this
require_once('../includes/classes/facebook-platform/php/facebook.php');
$fb = new Facebook($api_key, $secret);
$fb->api_client->stream_get('',$app_id,'0','0','','','','',''));
But I get this error
Fatal error: Uncaught exception 'FacebookRestClientException' with message 'user id parameter or session key required' in includes/classes/facebook-platform/php/facebookapi_php5_restlib.php:3065
Stack trace:
#0 includes/classes/facebook-platform/php/facebookapi_php5_restlib.php(1915): FacebookRestClient->call_method('facebook.stream...', Array)
#1 facebook/api.php(12): FacebookRestClient->stream_get('', 13156929019, '0', '0', 30, '', '', '', '')
#2 {main}
thrown in includes/classes/facebook-platform/php/facebookapi_php5_restlib.php on line 3065
Then I figured, because of 'user id parameter or session key required', to add my user id to the call
require_once('../includes/classes/facebook-platform/php/facebook.php');
$fb = new Facebook($api_key, $secret);
$fb->api_client->stream_get(502945616,13156929019,$app_id,'0','0','','','','',''));
But then I got this error
Fatal error: Uncaught exception 'FacebookRestClientException' with message 'Session key invalid or no longer valid'
I'm totally clueless :)