[英]Facebook Registration Plugin?
我将如何获取Facebook注册插件的结果并将其通过电子邮件发送给自己?
Well, you should post what you have got so far..anyway, as described in the documentation : 好吧,无论如何,您应该发布到目前为止所获得的..,如文档中所述:
The data is passed to your application as a signed request.
数据作为签名请求传递到您的应用程序。 The signed_request parameter is a simple way to make sure that the data you're receiving is the actual data sent by Facebook.
signed_request参数是确保您接收的数据是Facebook发送的实际数据的一种简单方法。
So you need to specify the redirect_uri
and then process/extract the data you want from the signed_request
and email it with the method you are using. 因此,您需要指定
redirect_uri
,然后从signed_request
处理/提取所需的数据,并使用您所使用的方法通过电子邮件发送。 How to process the data is described in the bottom of the document I linked above: 我上面链接的文档的底部描述了如何处理数据:
<?php
define('FACEBOOK_APP_ID', 'your_app_id');
define('FACEBOOK_SECRET', 'your_app_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);
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, '-_', '+/'));
}
if ($_REQUEST) {
echo '<p>signed_request contents:</p>';
$response = parse_signed_request($_REQUEST['signed_request'],
FACEBOOK_SECRET);
echo '<pre>';
print_r($response);
echo '</pre>';
} else {
echo '$_REQUEST is empty';
}
?>
So instead of the print_r
and echo
functions, send the fields you want! 因此,请发送所需的字段而不是
print_r
和echo
函数!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.