用户ID /所有者粉丝页面ID(Facebook粉丝页面应用程序)

时间:2011-01-07 15:44:19

标签: facebook forms facebook-page

我正在开发一个包含表格的facebook粉丝页面应用程序。

我在发送表单后无法检索以下信息:

  • 填写表格的用户的用户名
  • 粉丝所有者的用户ID /邮件

2 个答案:

答案 0 :(得分:0)

我认为你可以使用FB PHP SDK使用FQL

示例:

    $pages = $facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT page_id FROM page_admin WHERE uid = '.$uid.''
));

答案 1 :(得分:0)

//我认为这会对你有所帮助

<?php session_start();?>    
    <?php require 'src/facebook.php';
        $app_id = "your_app_id";
        $app_secret = "your_secret_key";
        $facebook = new Facebook(array(
        'appId' => $app_id,
        'secret' => $app_secret

        ));

             $canvas_page = "https://www.facebook.com/page_name/app_appid"; //this is you facebook app url

             $auth_url = "http://www.facebook.com/dialog/oauth?client_id=" 
                    . $app_id . "&redirect_uri=" . urlencode($canvas_page);

             $signed_request = $_REQUEST["signed_request"];

             list($encoded_sig, $payload) = explode('.', $signed_request, 2); 

             $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

             if (empty($data["user_id"])) {
                    echo("<script> top.location.href='" . $auth_url . "'</script>");
             } else {
                    echo $data["user_id"];
                    $_SESSION['fbuser']=$data["user_id"];
             }