これにはいくつかのAPIがあります。最後のグラフAPIを使用することをお勧めします。次に、あなたはいくつかのSDKを持っています、私はPHPとJavascript SDKを知っています。あなたは
<body>
<div>
<button id="login">Login</button>
<button id="logout">Logout</button>
<button id="disconnect">Disconnect</button>
</div>
<div id="user-info"></div>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
// initialize the library with the API key
FB.init({ apiKey: 'YOUR_API_KEY' });
// fetch the status on load
FB.getLoginStatus(handleSessionResponse);
$('#login').bind('click', function() {
FB.login(handleSessionResponse, {
// here you specify the perms your application requires
perms:'publish_stream, offline_access, manage_pages, read_stream'
});
});
$('#logout').bind('click', function() {
FB.logout(handleSessionResponse);
});
$('#disconnect').bind('click', function() {
FB.api({ method: 'Auth.revokeAuthorization' }, function(response) {
clearDisplay();
});
});
// no user, clear display
function clearDisplay() {
$('#user-info').hide('fast');
}
// handle a session response from any of the auth related calls
function handleSessionResponse(response) {
// if we dont have a session, just hide the user info
if (!response.session) {
clearDisplay();
return;
}
// if we have a session, query for the user's profile picture and name
FB.api('/me/accounts', function(response) {
$('#user-info').html(JSON.stringify(response));
});
}
</script>
</body>
この例を行うことができますjQueryを使ってJavaScriptで
は、JavaScriptのSDKのドキュメントから取得されます。あなたはfacebook developperページからAPI_KEYを入手する必要がありますhttp://www.facebook.com/developers/apps.php
あなたが試みたリクエストについてより明確になるはずです。 –
アカウントの自動登録はスパマーがやるように聞こえます – CodesInChaos
@CodeInChaos、私はあまり早くそう言わなかったでしょう、彼に説明するチャンスを残してください;) –