我对Google recaptcha的回复有误。 拜托,你能帮我找一下我的错误吗?
function captcha(){
$secret = "...";
$response = $_POST['g-recaptcha-response'];
$remoteip = $_SERVER['REMOTE_ADDR'];
$api_url = "https://www.google.com/recaptcha/api/siteverify?secret=".$secret."&response=".$response."&remoteip=".$remoteip;
$decode = json_decode(file_get_contents($api_url), true);
if ($decode['success'] == true) {
return $decode['success'];
}else{
$errorsCode = "";
foreach ($decode['error-codes'] as $key => $value) {
$errorsCode .= '<p><strong>' . $key.':</strong> '.$value.'</p>';
}
return $errorsCode;
}
}
我总是得到同样的错误:missing-input-response。
感谢您的帮助!
编辑:由 Mrpink
解决https://gist.github.com/jonathanstark/dfb30bdfb522318fc819