catch(FacebookRequestException $ex) { // When Facebook returns an error } catch(\Exception $ex) { // When validation fails or other local issues } if ($session) { // Logged in. }
profile update time ▸ The first 4 events that the user is attending & first 2 photos from each event ▸ The first 3 pages the user likes ▸ The first 5 photos the user is tagged in
$photos_user_tagged_in = $fqb ->edge('photos') ->fields('name', 'source') ->limit(5); // Get first 3 pages this user likes $pages_user_likes = $fqb ->edge('likes') ->fields('name', 'link') ->limit(3); // Get first 4 events that this user is attending // And first 2 photos from each event $event_photos = $fqb ->edge('photos') ->fields('name', 'source') ->limit(2); $events_user_attending = $fqb ->edge('events') ->fields('name', 'start_time', 'end_time', $event_photos) ->limit(4); // Get the logged in user's name, last profile update time, and all those edges $user_data = $fqb->object('me') ->fields('name', 'updated_time', $photos_user_tagged_in, $pages_user_likes, $events_user_attending); ->get();