-1
- 登錄與您的谷歌帳戶
2.Visit谷歌的驗證碼鏈接。谷歌隱形Recaptch整合PHP
3.然後按照代碼集成的鏈接,遵循客戶端和服務器端驗證的代碼。 https://developers.google.com/recaptcha/docs/invisible
4.增加或創建的ReCaptcha後,到這裏提前設置,一旦降低安全級別,https://www.google.com/recaptcha/admin#list
<!--
i.stack.imgur.com slash NqyVT.png
6aZNw.png
n5gfN.png
Button HTML
<div id='recaptcha' class="g-recaptcha"
data-sitekey="put the key here"
data-callback="onSubmit"
data-size="invisible"
data-callback="callback"></div>
<button id='btnsubmit' class="c-button--primary">Submit</button>
//Apply the exact script from document
//PHP Validation
if($_POST['g-recaptcha-response'] != ''){
$post_data = http_build_query(['secret'=>'put the secret key here', 'response'=>$_POST['g-recaptcha-response'] ]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Send the request
$result = json_decode(curl_exec($ch), true);
// Free up the resources $curl is using
curl_close($ch);
//print_r($result);exit();
$hostname = strtolower($result['hostname']);
//echo $hostname.' - '.$result['success'];exit();
if($result['success'] == 1 && ($hostname == 'www.yousiteurl.com')){
//Write here actual execution code for email or data submit
}
}
-->
什麼是你的問題? –