access graph data without forcing user to login

Go To StackoverFlow.com

0

I am looking to pull data from a fb page to a website without having a user authenticate.

The data I wish to display on a webpage is the event listing for a fb page, both the page and the events are open, and I can grab the page and event data ok, eg

http://graph.facebook.com/PAGEID http://graph.facebook.com/EVENTID

But to get a list of the events in order to get the eventIDs an access token is required eg

http://graph.facebook.com/PAGEID/events

Is this possible to get this data without having a user login to fb and authorise with an application ? I have looked at just saving an access token but this seems to expire.

any suggestions/pointers would be great, thanks in advance

2012-04-03 23:37
by Keet
Short answer, no - Paul Dessert 2012-04-03 23:46
Thanks @Paul that's what I was thinking, I suppose there is no long answe is there - Keet 2012-04-04 12:04


0

Providing a quick solution to this set up an app and get an access token, note it would be best to cache the result data so as to not make an api call on each page load

<?php

//set your app id, client_secret and fb id
$client_id = 'xxx';
$client_secret = 'xxx';
$fbID = 'xxx';

//get an access token
$access_token = file_get_contents("https://graph.facebook.com/oauth/access_token?    type=client_cred&client_id=".$client_id."&client_secret=".$client_secret);

//use this access token to return the events
$jsonurl = "https://graph.facebook.com/$fbID/events?$access_token";
$json = file_get_contents($jsonurl,0,null,null);

// do stuff with $json
?>
2012-04-20 17:24
by Keet