Google reCAPTCHA使用方式
發表於 : 2016年 8月 3日, 11:48
參考這篇:
https://codeforgeek.com/2014/12/google- ... -tutorial/
先到 google recaptcha 申請:
https://www.google.com/recaptcha/
會取得 Site Key 與 Secret , 將取得的 Site Key 放到表單頁如下:
Server Side 程式需要對 google 發起 post 到
https://www.google.com/recaptcha/api/siteverify
內容包含:
secret / response (由表單頁帶來的 g-recaptcha-response) / remoteip
回應為 JSON
測試網頁: http://sample.diary.tw/41/google-recaptcha-test.htm
https://codeforgeek.com/2014/12/google- ... -tutorial/
先到 google recaptcha 申請:
https://www.google.com/recaptcha/
會取得 Site Key 與 Secret , 將取得的 Site Key 放到表單頁如下:
代碼: 選擇全部
<script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="[Site Key]"></div>
https://www.google.com/recaptcha/api/siteverify
內容包含:
secret / response (由表單頁帶來的 g-recaptcha-response) / remoteip
回應為 JSON
代碼: 選擇全部
{
"success": true|false,
"challenge_ts": timestamp, // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
"hostname": string, // the hostname of the site where the reCAPTCHA was solved
"error-codes": [...] // optional
}