English 中文(简体)
在一页子上打造Facebook用户身份,不再奏效
原标题:Getting Facebook User ID on a Fanpage is Not Working Anymore

该代码用于罚款,但现在的<编码>用户_id在我的<编码>$data物体中缺失。 我已经想到,从用户与网页一样,他更是匿名,你可以使用该代码打上他的身份证。 这是我一贯使用的法典:

require_once  assets/requests/facebook-php-sdk-dafef11/src/facebook.php ;

$secret = "XXX";
$data = parse_signed_request($_REQUEST[ signed_request ], $secret);


function parse_signed_request($signed_request, $secret) {
 list($encoded_sig, $payload) = explode( . , $signed_request, 2); 

 // decode the data
 $sig = base64_url_decode($encoded_sig);
 $data = json_decode(base64_url_decode($payload), true);
 echo   FUID:  , $fuid = $data[ user_id ];    // NO USER ID HERE ANYMORE
 echo  <pre>  , var_dump($data),  </pre> ;

 if (strtoupper($data[ algorithm ]) !==  HMAC-SHA256 ) {
     error_log( Unknown algorithm. Expected HMAC-SHA256 );
     return null;
 }

 // check sig
 $expected_sig = hash_hmac( sha256 , $payload, $secret, $raw = true);
 if ($sig !== $expected_sig) {
     error_log( Bad Signed JSON signature! ); 
     return null;
 }

 return $data;
}

function base64_url_decode($input) {
 return base64_decode(strtr($input,  -_ ,  +/ ));
}

array(4) {
  ["algorithm"]=>
  string(11) "HMAC-SHA256"
  ["issued_at"]=>
  int(1321524964)
  ["page"]=>
  array(3) {
    ["id"]=>
    string(15) "227488627318218"
    ["liked"]=>
    bool(true)
    ["admin"]=>
    bool(false)
  }
  ["user"]=>
  array(2) {
    ["locale"]=>
    string(5) "de_DE"
    ["age"]=>
    array(1) {
      ["min"]=>
      int(21)
    }
  }
}

脸谱变化吗?

问题回答

你们是否使用旧的b子——ig子? 我不想听说它意味着什么,而是白白白白天被拆除。 他们说,这在10月1日被删除,但我认为他们实际上在上周末将其删除:

http://developers.facebook.com/blog/post/497/





相关问题
Facebook Connect login dialog not working

I am using Facebook Connect for iPhone and following the official instructions. I use the following code to display the login dialog: FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:...

Facebook App Profile Tab is Empty ... No Content Displayed?

I can view my application via the http://apps.facebook.com/myapplication/ link and the content shows up correctly. I also added the application as a tab to a facebook page. However, when viewing the ...

Facebook Platform error: "Object cannot be liked"

I m working on a Facebook Application that generates wall posts. In testing these posts, I ve discovered that the Facebook Platform action of "liking" a post is failing. The specific error message ...

how to call showPermissionsDialog() in php (facebook api)?

I was reading over the documentation yet I could not figure out how to call Facebook.showPermissionsDialog() in php include_once ./facebook-platform/php/facebook.php ; $facebook = new Facebook(my ...

Facebook connect

If I plug in the facebook connect into my website, How can I prevent double signups? Lets say I have a user that s already signed up to my site but he clicked the connect with facebook, is there a ...

热门标签