开发者

User ID / Owner Fan Page ID (Facebook Fan Page Application)

I am developing a facebook fan page application witch includes a form.

I have trouble retrieving the following information after the form is been sent:


//i think this will help you

<?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"];
             } 


I think you can use a FQL using the FB PHP SDK

example:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜