Post to Facebook Group Wall PHP API
Since I wrote tutorial Post to Facebook Page Wall
, few people have asked me to write a tutorial that will post messages on Group wall as well. If you look at previous examples, you should be pretty clear how everything works, posting message or link works very similar way as before, by issuing HTTP POST request to the GROUP_ID/feed.
Before we begin, I suggest you have a look at this article : Post to Facebook Page Wall
, I have only made few modifications to that previous examples, which are explained below:
Listing user Groups
To get user group information, user must allow user_groups
permission. Once this permission is granted, your application can acquire user group information using FQL (Facebook Query Language). If you look at index.php
, you can see I have modified FQL to list all groups where user is a member.
select gid, name from group where gid IN (SELECT gid FROM group_member WHERE uid=23430809234)
To list only groups where user is administrator :
select gid, name from group where gid IN (SELECT gid FROM group_member WHERE uid=23430809234 AND administrator='true')
Posting message to groups works similar way as posting to user pages wall. Difference here is, we use Group ID instead of Page ID in $post_url