在Facebook中集成独立php应用程序
我已经创建了一个小应用程序,基本上是一个测验应用程序,我将在一个免费的网络托管网站上启动它。我想把它和Facebook结合起来。但主要有两个问题 我希望该应用程序仅由FB用户使用,他们是我创建的一个封闭组的特定组的成员 测验一结束,最后的分数就应该贴在小组的墙上 PS:我的意思是,他们只有在使用Facebook注册时才能开始测试。在Facebook中集成独立php应用程序,php,facebook,Php,Facebook,我已经创建了一个小应用程序,基本上是一个测验应用程序,我将在一个免费的网络托管网站上启动它。我想把它和Facebook结合起来。但主要有两个问题 我希望该应用程序仅由FB用户使用,他们是我创建的一个封闭组的特定组的成员 测验一结束,最后的分数就应该贴在小组的墙上 PS:我的意思是,他们只有在使用Facebook注册时才能开始测试。 欢迎任何其他想法。使用facebook所需的一切,包括但不限于您解释的确切要求,都可以使用facebook Connect API实现。这是非常全面的,我不能解释你将
欢迎任何其他想法。使用facebook所需的一切,包括但不限于您解释的确切要求,都可以使用facebook Connect API实现。这是非常全面的,我不能解释你将如何在这个答案做整个事情。这是一个很好的起点:
你需要做很多事情。假设您使用的是FB JS SDK,则需要使用以下内容 通过FB.login请求发布流和用户组扩展权限 通过FB.api发布到组墙,例如。。。api'/GROUP_ID/feed',post',{message:'yay someone completed the quick'},functionresponse{alertresponse;}; 使用FB JS SDK组检查的部分示例未实现
<a onclick="postToGroupWall()">Post msg to group wall</a>
<script>
window.fbAsyncInit = function()
{
FB.init({
appId : 'APP_ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true , // parse XFBML
oauth : true // Enable oauth authentication
});
FB.login(function(response)
{
if (response.authResponse)
{
alert('Logged in!');
// Check if user is in group using opengraph call (/me/groups) via FB.api
// Do that here...
}
else
{
alert('Not logged in - do something');
}
}, { scope : 'publish_stream,user_groups' });
};
window.postToGroupWall = function()
{
var opts = {
message : 'Yay I just completed the quiz',
name : '',
link : 'http://www....',
description : 'Description here',
picture : 'http://domain.com/pic.jpg'
};
FB.api('/GROUP_ID/feed', 'post', opts, function(response)
{
if (!response || response.error)
{
alert('Posting error occured');
}
else
{
alert('Success - Post ID: ' + response.id);
}
});
};
</script>
<!-- FACEBOOK -->
<div id="fb-root"></div>
<script>
(function() {
var e = document.createElement('script');
// replacing with an older version until FB fixes the cancel-login bug
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
//e.src = 'scripts/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<!-- END-OF-FACEBOOK -->