Facebook API: Fetch events from Page as decoded JSON (Object)

<?php $fields = "id,name"; $page_id = "xxx"; $token = "xxx"; $object = json_decode(file_get_contents("https://graph.facebook.com/v2.8/".$page_id."/events?fields=".$fields."&access_token=".$token)); ?> <pre> <?php print_r($object); ?> </pre>
Facebook v2.8 - Facebook-Page-App required ( https://developers.facebook.com/apps/)

page-id
http://findmyfbid.com

token (App Token)
https://developers.facebook.com/tools/accesstoken/

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.