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. [cc lang="fql"] select gid, name from group where gid IN (SELECT gid FROM group_member WHERE uid=23430809234) [/cc] To list only groups where user is administrator : [cc lang="fql"] select gid, name from group where gid IN (SELECT gid FROM group_member WHERE uid=23430809234 AND administrator='true') [/cc]

Post Message

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.

Download Demo

  • Hello bro. Could you help me solve this problem when I using your script, error "REST API is deprecated for versions v2.1 and higher" occurred
  • Dear, I want to share my post links in all groups where I am connected. I modifies your scripts. I got this error. It looks like you were misusing this feature by going too fast. You’ve been blocked from using it. Learn more about blocks in the Help Center. I used below stated info, but this time I am not getting post image. Only text is posted. $link = "https://www.facebook.com/video.php?v=1785812478309779"; $userMessage = "This Amazing Commercial Random Act Of Kindness From Thailand Will Make You Cry #EmotionalAdvertisement #AmazingCommercial"; Please help for this.
  • Hello guys, I'm just wondering how to do this I've created a facebook app and I'm having problems getting the correct permissions. How did you guys get those permissions for your apps?
  • Does this require the Facebook App to be approved for the "user_groups" permission? I read in this documentation here: https://developers.facebook.com/docs/facebook-login/permissions/v2.0#permission-user_groups "Provides access to the list of groups the user is a member of as the groups connection. This permission is reserved for apps that replicate the Facebook client on platforms that don’t have a native client. It may only be used to provide people with access to this content. It make take up to 14 days for your app to be reviewed." Did you have to go through that waiting process in order to be able to post to groups? Or is all that is needed is for the user to grant that permission? Thanks, Daniel
New question is currently disabled!