Facebook registration protocol
I am making a marketing tool that is required to register facebook accounts using web requests. I have been trying to understand the protocol but I always end up with a "Sorry there is something went rong" page. Any explanations are appreciated =].
Regards
edit: I am trying to let the user to register on facebook through my application. He should input the required fields (names,birthday,email) and the application should do the signup process for him after he solves the开发者_如何学编程 captcha that will be fetched from facebook. It's not a spam attempt, Don't bother saying you won't answer because it's a spam attempt. If you think so, just don't answer.
edit: I don't want to use any WebBrowser controls, I need it to be through HTTP Requests.
edit: I try to imitate requests sent to facebook from my computer using fiddler, I believe I imitated everything that facebook website does. Though I still getting "Sorry something went wrong" page.
You have several API to to that. I recommend that you use the last one, the graph API. Then you have several SDK, I know PHP and Javascript SDK.
In javascript, with jQuery you can do
<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>
This example is taken from the documentation of the JavaScript SDK. You need to get you API_KEY from the facebook developper page http://www.facebook.com/developers/apps.php
精彩评论