该代码用于罚款,但现在的<编码>用户_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)
}
}
}
脸谱变化吗?