Signed Request - how can i find if a facebook user liked my fb application? -
Signed Request - how can i find if a facebook user liked my fb application? -
i trying find if user likes facebook application or not , utilize functions:
function parse_signed_request($signed_request, $secret) { list($encoded_sig, $payload) = explode('.', $signed_request, 2); // decode info $sig = base64_url_decode($encoded_sig); $data = json_decode(base64_url_decode($payload), true); if (strtoupper($data['algorithm']) !== 'hmac-sha256') { error_log('unknown algorithm. expected hmac-sha256'); homecoming null; } // check sig $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true); if ($sig !== $expected_sig) { error_log('bad signed json signature!'); homecoming null; } homecoming $data; } function base64_url_decode($input) { homecoming base64_decode(strtr($input, '-_', '+/')); } $decodedsr = parse_signed_request($_request['signed_request'],$config['secret']); //print_r($decodedsr ); if ($decodedsr['page']['liked'] == 1) {//code}
the problem code (print_r($decodedsr );
) returns array (without ['page']['liked'] ):
array ( [algorithm] => hmac-sha256 [expires] => 0 [issued_at] => xxx[oauth_token] => xxxxxx[user] => array ( [country] => xx [locale] => xx [age] => array ( [min] => 21 ) ) [user_id] => xxxxx)
what should do?
you can find elements of answers in topics :
topic 1 topic 2 topic 3on lastly 1 noticed ifaour made tutorial how check if user fan of page. here "how-to" page.
just @ other topics on forum question has been asked sooo many times ! :)
request facebook-apps signed
Comments
Post a Comment