Reputation: 866
I have a site where people can make posts on it, and I need these posts to go straight to the feed of a group in Facebook. (I am the owner of the group)
Is it possible? What do I need? How should it work?
I found this https://github.com/facebook/php-sdk, but I don't if it is what I need, and couldn't figure out how does it work.
Upvotes: 1
Views: 8526
Reputation: 1
function Promote(){
var lnk = 'http://www.wootube.woolei.com?v=<?php echo $_GET["id"] ?>';
FB.login(function(response)
{
if (response.authResponse)
{
//Post To WooTube Group
FB.api('/271691796276524/feed', 'post', {
message: lnk,
link: lnk,
},
function(response) {
if (!response || response.error) {
//alert('You have to join the group first!');
} else {
//alert("Successfully Posted to WooTube Group!");
}
});
//Post to Wootube Page
FB.api('/173724382762792/feed', 'post', {
message: lnk,
link: lnk
},
function(response) {
if (!response || response.error) {
//alert('You have to like http://www.facebook.com/WooTubes first!');
} else {
//alert("Successfully Posted to WooTube Page!");
}
});
}
else
{
alert('Not logged in');
}
}, { scope : 'publish_stream' });
}
Upvotes: 0
Reputation: 31
i have a similar function in my application - wootube, i added a "Share To WooTube Page & Group" button using fb.api .
After the user click the link it will automatically post to wootube group and wootube page.
here is the screen shot if you want to see how it look like. https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-ash4/383568_191076937694203_922285357_n.jpg
function Promote(){
var lnk = 'http://www.wootube.woolei.com?v=<?php echo $_GET["id"] ?>';
FB.login(function(response)
{
if (response.authResponse)
{
//Post To WooTube Group
FB.api('/271691796276524/feed', 'post', {
message: lnk,
link: lnk,
},
function(response) {
if (!response || response.error) {
//alert('You have to join the group first!');
} else {
//alert("Successfully Posted to WooTube Group!");
}
});
//Post to Wootube Page
FB.api('/173724382762792/feed', 'post', {
message: lnk,
link: lnk
},
function(response) {
if (!response || response.error) {
//alert('You have to like http://www.facebook.com/WooTubes first!');
} else {
//alert("Successfully Posted to WooTube Page!");
}
});
}
else
{
alert('Not logged in');
}
}, { scope : 'publish_stream' });
}
Upvotes: 0
Reputation: 11852
To do this you'll need to:
POST
those comments to your Facebook group using the Graph API.Additionally, to prevent spam, you may want to authenticate your users with Facebook before they comment.
If you're doing this in PHP, the PHP SDK saves you a lot of coding. To use it, your php environment must have cURL installed and enabled.
Upvotes: 1