How to return all groups I participate in facebook in rss, json, php

2

Good afternoon, I have a question I have already researched everywhere but facebook has changed api, and it is not retuning the groups, I would like to know if I can return in some format all the links of my groups or some way to treat this page link returning only the links

    
asked by anonymous 10.08.2015 / 21:18

1 answer

1

You can use the SDK to show all groups as a member:

https://developers.facebook.com/docs/graph-api/reference/user/groups/

You will need the permission user_groups and / or user_managed_groups to list the groups that the member manages.

Endpoint is "/{user-id}/groups" or "/me/groups" if it is to show the groups of the member that is authenticated.

As an example, copy the code below and put it on the Facebook test page , click on "Run code" (blue button) and then click on the link that will show below the box where you put the code that will say "Show my groups"

<a href="#" id="run-btn">Mostra os meus grupos</a>
<ul id="groups"></ul>

<script type="text/javascript">
  document.getElementById('run-btn').onclick = function() {
    FB.login(function(response) {
      if (response && !response.error) {

console.log("Login ------------------------------");
console.log(response);

        getAllGroups(response.authResponse.userID);
      } else {
        // o utilizador nao deu permissoes...
      }
  }, {scope: 'user_groups'});
  return false;
}

function getAllGroups() {
  FB.api("/me/groups", function (response) {

console.log("Groups ------------------------------");
console.log(response);

      if (response && !response.error) {
         for(i=0; i<response.data.length; i++) {
            var group = response.data[i];
            document.getElementById("groups").innerHTML += 
                 "<li><a href='https://www.facebook.com/groups/" + group.id + "'>" + group.name + "</a> (" + group.id + ")</li>";
         }
      }
    });
}
</script>

return code above:

    
10.08.2015 / 22:34