Google CAPTCHA in Java

2

I'm having trouble deploying Google's CAPTCHA.

On the form page I've added the script and the div of the captcha:

<head>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>

<form action='../envio_formularios/sendEmail_faca_proposta.jsp' >
<input name='Nome_0' id='nome_0' type='text'>
<input name='Email_1' id='email_1' type='text'>
<div class="g-recaptcha" data-sitekey="coloquei minha key aqui"></div>
<input type="submit"> 
</form>

So long so good ....

Problem is in sendEmail , how do I validate the key that was returned by the script?

Then I saw that I had this code in PHP:

 $secretKey = "Put your secret key here";
    $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 ! Get the @$%K out</h2>';
    } else {
      echo '<h2>Thanks for posting comment.</h2>';
    }

How could I convert this request to JSP?

    
asked by anonymous 18.02.2016 / 19:16

0 answers