Access Facebook Fan Page Events
Auf Events von Facebook Fan Seiten kann man nicht zugreifen über die GRAPH API. Dieses kleine Tutorial zeigt wie es funktioniert in Kombination einer registrierten Facebook App!
How to access all Facebook Fan Page events? Facebook Fan Pages are public, so for me it makes no sense why facebook needs an authentitification to get those informations (as you can see trough this url, an access token is needed: http://graph.facebook.com/YOUR_FACEBOOK_PAGE_NAME_OR_ID/events). The easiest and fastests way to get all events from a Facebook "Fan-Page" is using the Facebook client-side API class with the authentification trough a registered Facebook App.
In the following 3 steps i try to explain what i have done to get all events from a Facebook Fan Page:
1. You need an App (the App must not have something in common with the fan page you want to access). With this app you can get the "auth_token", so register your APP: https://www.facebook.com/developers/.
2. Download the Facebook client-side API class: curl -L http://github.com/facebook/php-sdk/tarball/master | tar xvz
3. Authentificataded trough your App, u can now access the hidden Facebook graph API parts, like events!
// https://www.facebook.com/developers/apps.php?app_id=
require_once 'src/facebook.php'; // include facebook api class from step 2
// your will find the appId and appSecret in you app settings:
$fb = new Facebook(array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
'cookie' => true
));
// accessing the events from a facebook page. the facebook page can be the unique id or the rewritename/username u can // set after 30(or more) fans.
$data = $fb->api('YOUR_FACEBOOK_PAGE_NAME_OR_ID/events');
var_dump($data);
ps: In my case I also have created a caching class which saves the informations ($data) for a limited time to avoid a long page loading time!
Letzte Beitrag änderung am 28.04.2011 um 16:29 Uhr
Fragen zum Script, einen Fehler melden oder eine wichtige ergänzung mitteilen? Kontaktieren Sie uns einfach.






Hochwertige, handgemachte Produkte für den Tisch und die Küche
PHP Lab - Gratis und Hilfreich für Jedermann!