How do I integrate the invite multiple friends from facebook to my site
I want to integrate an invite friends from facebook o开发者_运维知识库ption like how foursquare have implemented it. I checked out the fb:Request form but wasn't able to run it successfully. Plus I heard theyre deprecating the legacy FBML library so is there any better way of doing this?
I'm working in php here.
The Facebook requests dialog has replaced it. It uses the Facebook javascript SDK.
Full example (click here to run it on jsfiddle):
<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
<a href="#" onclick="sendRequests();return false;">Invite your friends</a>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({ appId: '**yourAppId**', status: true, cookie: true, xfbml : true });
function sendRequests() {
FB.ui({method: 'apprequests', message: 'You should learn more about this awesome site.', data: 'tracking information for the user'},
function(response) {
if (response != null && response.request_ids && response.request_ids.length >0) {
for(var i = 0; i < response.request_ids.length; i++) {
alert("Invited: " + response.request_ids[i]);
}
} else {
alert('No invitations sent');
}
});
}
</script>
</body>
</html>
精彩评论