dq_609586475 2017-04-10 10:56
浏览 97

Google Recaptcha v2 - 500内部服务器错误

Recaptcha v2 has stopped working across my sites, returning a 500 server error.

I've tried rejigging the code in case its an issue at my end but to no avail.

Can anyone see an issue with the below? All help appreciated

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>';
        }
    ?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办
    • ¥15 Python爬取指定微博话题下的内容,保存为txt
    • ¥15 vue2登录调用后端接口如何实现
    • ¥65 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)