How to get the stream of a public Facebook fanpage in php?

Posted by Bundy on Stack Overflow See other posts from Stack Overflow or by Bundy
Published on 2010-01-11T10:13:45Z Indexed on 2010/05/06 13:38 UTC
Read the original article Hit count: 220

Filed under:
|
|

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 :)

© Stack Overflow or respective owner

Related posts about php

Related posts about facebook