2011-01-07 214 views

回答

0

我想你可以使用FB PHP SDK

例如使用FQL:

$pages = $facebook->api(array(
'method' => 'fql.query', 
'query' => 'SELECT page_id FROM page_admin WHERE uid = '.$uid.'' 
)); 
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"]; 
      }