1

i have tried to get facebook group id (gid) by it's url using C#, with no luck. I have looked over the facebook graph tables, tried PHP, FQL queries, and even tried P3P to get the feed itself of the group page (To get the 'cid' value) - But again - with no luck, I'm getting a token successfully using facebook SDK but I dont understand how to use it to get the group id or the group source code (which always returns the login page), can you help ?

1 Answers1

0

You can fetch the username from the url- string after last /. You can find how to do that. Then simply use the Search API.

You'll be needing a valid user access token with the API call-

/search?q={group-username}&type=group

Example: https://graph.facebook.com/search?q=progressivenagars&type=group&access_token={access-token}

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90
  • First of all, thank you for the answer! Your solution indeed works, but only for some of the groups. And that is the real problem. For example - it won't work for the group 'dirotTA' (Link: https://www.facebook.com/groups/dirotTA). The reason is probably because there is a user with that name exactly, and the result is the id of that user... – user2902618 Apr 28 '14 at 18:47
  • I'm not sure but I think that's best what you can do! Since graph api wont give any results directly using the username unlike user's username – Sahil Mittal Apr 28 '14 at 19:02
  • Well there must be a way because for example: lookup-id.com does that, and also other websites as well... – user2902618 Apr 28 '14 at 19:08
  • Well these sites are probably just parsing the webpages and nothing else, since these sites objective is just to get you the id; and parsing is not a big job. As far as what seems to me, using the graph api that's what you can do! – Sahil Mittal Apr 28 '14 at 19:43
  • Any idea on how they are parsing the webpages ? I can't get the source code of the page since it sends me to the login screen when i'm trying. – user2902618 Apr 28 '14 at 19:47