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
But to get a list of the events in order to get the eventIDs an access token is required eg
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
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 ?>