I have an error with the response of Google recaptcha. Please, could you help me to find my error ?
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;
}
}
I get always the same error : missing-input-response.
Thank you for your help !
EDIT : Solved with https://gist.github.com/jonathanstark/dfb30bdfb522318fc819 by Mrpink