Recaptcha v2已停止在我的网站上工作,返回500服务器错误。
我已尝试重新调整代码,以防我的问题在我的结尾但无济于事。
任何人都可以看到下面的问题吗?所有帮助表示赞赏
FORM
<form id="the_form" action="theprocess.php" method="post">
<input type="text" name="demoinput" id="demoinput">
<input type="submit" name="submit" value="Postit">
<script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="mysitekey"></div>
</form>
PROCESS
<?php
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
$secretKey = "mysecretkey";
$ip = $_SERVER['REMOTE_ADDR'];
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
$responseKeys = json_decode($response,true);
if(intval($responseKeys["success"]) !== 1) {
echo '<h2>You are spammer !</h2>';
} else {
echo '<h2>Thanks for posting comment.</h2>';
}
?>