【发布时间】:2017-09-09 17:22:31
【问题描述】:
我已经在我的网站上安装了 google recaptcha V2,我想在 google recaptcha 完成后自动提交表单(无需按任何按钮),这是我的代码...
$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
}
这是我的表格....
<form action="" method="post" class="Form" enctype="multipart/form-data">
<div class="g-recaptcha" data-sitekey="HIDDEN"></div>
</form>
感谢阅读,祝你有美好的一天!
【问题讨论】:
-
使用计时器并持续 ping 服务器以查看验证码是否已通过验证。如果验证通过,请提交表单。
标签: javascript php jquery html recaptcha