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

Asked

Viewed 1,501 times

2

Good afternoon, I’m with a doubt I’ve researched everywhere but facebook has changed api, and not this retouching the groups, I wonder if have how to return in some format all links of my groups or some way to treat this page https://www.facebook.com/groups/? Category=Membership returning only the links

1 answer

1

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

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

You’ll need the permission user_groups and/or user_managed_groups to list the groups the member manages.

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


as an example, copy the tapeworm below and place it in 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 of the above code:

inserir a descrição da imagem aqui

  • balexandre no consele funciona perfeitamente pas using my appid just shows the group I manage vc know pq?

  • needs the scope: user_groups when making the application...

  • even with permission only shows what I manage :/ but just listing by the console has helped me much worth

  • @user2677216 if you can see what you are admin, it is because you are using user_managed_groups, but you also need to use, as I said before and in the answer user_groups... you have to re-authenticate with the new permission to return elements... not knowing how you’re authenticating yourself, I can’t help much more... By the way, if it helped you, mark it as the right answer so others with the same question can see what they need to do. :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.