i have installed google recaptcha V2 on my site, and i want automatically submit a form (WITHOUT PRESS ANY BUTTON) when google recaptcha is completed, here is my code...
$secretKey='HIDDEN';
$responseKey=$_POST['g-recaptcha-response'];
$IP=$_SERVER['REMOTE_ADDR'];
$url="https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$responseKey&remoteip=$IP";
$response=file_get_contents($url);
$response=json_decode($response);
if($response->success){
....execute some php
}
And here is my form....
<form action="" method="post" class="Form" enctype="multipart/form-data">
<div class="g-recaptcha" data-sitekey="HIDDEN"></div>
</form>
Thanks for read, have a nice day!
add a callback like this
<div class="g-recaptcha" data-sitekey="your-key-here" data-callback="submitForm" ></div>
Then include something like this in your javascript code
<script>
var submitForm = function () {
$("#formID-goes-here").submit();
}
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.