2011-01-06 134 views
0

我正在制作一个营销工具,需要使用网络请求注册Facebook帐户。我一直在试图理解协议,但我总是以“对不起,有些事情发生了”页面结束。任何解释都赞赏=]。Facebook注册协议

问候

编辑:我试图让用户通过我的应用程序在Facebook上注册。他应该输入必填字段(姓名,生日,电子邮件),并且应用程序应该在他解决将从facebook获取的验证码后为他执行注册过程。这不是垃圾邮件企图,不要打扰你说不会回答,因为这是垃圾邮件企图。如果你这么认为,就不要回答。

编辑:我不想使用任何WebBrowser控件,我需要它通过HTTP请求。

编辑:我尝试模仿使用提琴手从我的电脑发送到Facebook的请求,我相信我模仿了facebook网站所做的一切。虽然我仍然收到“抱歉出错了”页面。

+1

您应该更清楚地了解您尝试的请求。 – 2011-01-06 14:05:44

+2

帐户的自动注册听起来像垃圾邮件发送者会做的 – CodesInChaos 2011-01-06 14:06:50

回答

0

你有几个API来。我建议你使用最后一个图形API。然后你有几个SDK,我知道PHP和Javascript SDK。

在javascript中,使用jQuery你可以做

<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> 

这个例子是从的JavaScript SDK的资料为准。您需要从facebook开发者页面获取API_KEY http://www.facebook.com/developers/apps.php