msenkpiel
2/17/2012 - 9:52 AM

Read Facebook Public Event Feed via App Login Token

Read Facebook Public Event Feed via App Login Token

<?php

require('facebook-sdk/facebook.php');

define('APP_ID', 'XXXXXXXXX');
define('APP_SECRET', 'XXXXXXXXXXXXXXXXXX');

$facebook = new Facebook(array(
	'appId' => APP_ID,
	'secret' => APP_SECRET,
	'cookie' => false
));

$c = curl_init();
$url = 'https://graph.facebook.com/oauth/access_token?client_id='.APP_ID.'&client_secret='.APP_SECRET.'&grant_type=client_credentials';
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_USERAGENT, "User-Agent: Rambo");
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);

$token = curl_exec($c);
curl_close($c);

$token = str_replace('access_token=','', $token);
$params = array('access_token' => $token);

$eventFeed = $facebook->api('/EVENT_ID/feed','get', $params);

var_dump($eventFeed);