dszm02606009 2016-09-19 07:27
浏览 21

PHP在google recaptcha上获得意外的文件结尾[复制]

This question already has an answer here:

I need some help, i'm implementing the google recaptcha into a php site, but after finishing the code and uploading it this error is shown:

Parse error: syntax error, unexpected end of file in /home/cbj/public_html/2016/solicitudForm.php on line 29

now, here is my code for the recaptcha

<?php
    $memberType;$name;$email;$phone;$address;$captcha;
    if(isset($_POST['memberType'])){
      $memberType=$_POST['memberType'];
    }
    if(isset($_POST['name'])){
      $name=$_POST['name'];
    }
    if(isset($_POST['email'])){
      $email=$_POST['email'];
    }
    if(isset($_POST['phone'])){
      $phone=$_POST['phone'];
    }
    if(isset($_POST['address'])){
      $address=$_POST['address'];
    }
    if(isset($_POST['g-recaptcha-response'])){
      $captcha=$_POST['g-recaptcha-response'];
    }
    if(!$captcha){
      echo '<div class="alert alert-warning">
              Por favor, verifica que seas humano
            </div>';
      exit;
    }
    $secretKey = "6LeEECoTAAAAAGLUBgHQ_OC-ZYJi0Sj2b_1JPRUx";
    $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha);
    $responseKeys = json_decode($response,true);
    if(intval($responseKeys["success"]) !== 1) {
      echo '<h2>You are spammer ! Get the @$%K out</h2>';
    } else {
      echo '<h2>Thanks for posting comment.</h2>';
    } 
?>

Any help could be appreciated, thanks.

</div>
  • 写回答

1条回答 默认 最新

  • douzhi9395 2016-09-19 07:48
    关注

    for some reason the last semi colon was not detected (and not even saved) on local PC, writing the code directly in server makes work.

    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端