I need to your help to solve my problem. I'm using Google recaptcha V2 from last 4-5 years and it was working fine but all of sudden its showing following error:- We detected that your site isn't verifying reCAPTCHA solutions. This is required for the proper use of reCAPTCHA on your site. Please see our developer site for more information.

My Code:-

<?php
if(isset($_POST['submit'])):
    if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])):
        //your site secret key
        $secret = 'keykeykeykeykeykeykeykeykeykeykey';
        //get verify response data
        $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
        $responseData = json_decode($verifyResponse);
        
        $name = !empty($_POST['name'])?$_POST['name']:'';
        $email = !empty($_POST['email'])?$_POST['email']:'';
        $phone = !empty($_POST['phone'])?$_POST['phone']:'';
        $message = !empty($_POST['message'])?$_POST['message']:'';
        if($responseData->success):
            //contact form submission code
            $to = '[email protected]';
            $subject = 'Query Received from '.$name;
            $htmlContent = "
                <p><b>Name: </b>".$name."</p>
                <p><b>Email: </b>".$email."</p>
                <p><b>Contact No.: </b>".$phone."</p>
                <p><b>Message: </b>".$message."</p>
            ";
            // Always set content-type when sending HTML email
            $headers = "MIME-Version: 1.0" . "\r\n";
            $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
            $headers .= 'From: GREVE Main <[email protected]>' . "\r\n";
            //send email
            @mail($to,$subject,$htmlContent,$headers);
            
            $succMsg = 'Your contact request have submitted successfully.';
            $name = '';
            $email = '';
            $phone = '';
            $message = '';
        else:
            $errMsg = 'Robot verification failed, please try again.';
        endif;
    else:
        $errMsg = 'Please click on the reCAPTCHA box.';
    endif;
else:
    $errMsg = '';
    $succMsg = '';
    $name = '';
    $email = '';
    $phone = '';
    $message = '';
endif;
?>

Form Code:-

<div>
    <?php if(!empty($errMsg)): ?><div class="errMsg"><?php echo $errMsg; ?></div><?php endif; ?>
    <?php if(!empty($succMsg)): ?><div class="succMsg"><?php echo $succMsg; ?></div><?php endif; ?>
</div>

                        <form class="row call_back_form" action="" method="post">
  <table class="tab-font" width="80%" border="0" cellspacing="3" cellpadding="0" style="margin-left:15px;">
    <tr>
      <td align="left" valign="top">Your Name: <span class="red">*</span></td>
    </tr>
    <tr>
      <td align="left" valign="top"><input type="text" class="form-control" value="<?php echo !empty($name)?$name:''; ?>" name="name" ></td>
    </tr>
    <tr>
      <td align="left" valign="top">Your Email: <span class="red">*</span></td>
    </tr>
    <tr>
      <td align="left" valign="top"><input type="text" class="form-control" value="<?php echo !empty($email)?$email:''; ?>" name="email" ></td>
    </tr>
    <tr>
      <td align="left" valign="top">Contact No.: <span class="red">*</span></td>
    </tr>
    <tr>
      <td align="left" valign="top"><input type="text" class="form-control" value="<?php echo !empty($phone)?$phone:''; ?>" name="phone" ></td>
    </tr>
    <tr>
      <td align="left" valign="top">Your Message: <span class="red">*</span></td>
    </tr>
    <tr>
      <td align="left" valign="top"><textarea class="form-control" type="text" required name="message"><?php echo !empty($message)?$message:''; ?></textarea></td>
    </tr>
    <tr>
      <td align="left" valign="top"><div class="g-recaptcha" data-sitekey="6LdBzRMUAAAAALB3B_Jq11dcHeEf2d5jwxw2IBLm"></div></td>
    </tr>
    <tr>
      <td align="left" valign="top"><span style="color:#F00;">*</span>Read our updated <a href="terms.html" target="_blank">Terms of Use</a> and <a href="privacy.html" target="_blank">Privacy Policy</a> before submitting your query.</td>
    </tr>
    <tr>
      <td align="left" valign="top"><input type="submit" style="padding-bottom: 20px; padding-top: 10px; height: 65px;" class="btn submit_btn form-control" name="submit" value="SEND MESSAGE"></td>
    </tr>
  </table>
</form>
0

There are 0 answers