在google recaptcha的文档中说:
网址:https://www.google.com/recaptcha/api/siteverify
方法:POST
POST参数说明 秘密 - 必填。您网站与reCAPTCHA之间的共享密钥。
响应是一个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
}
我正在使用onloadCallback获得该响应,该用户在正确验证用户后调用函数,并自动提交表单。我在帖子中得到的是:
Array ([g-recaptcha-response] => 03AHJ_VuvxFs1t32j2Yn97X2tt8_86_XnXBLuMdY05BcYCBy-Jz1GWBCy9rGif83IJ59pq3C-0SdmlcxQwHHSz2CrRNBOFGc97Rb1W-0u0OxETOYufUJ5fRunvO_yOWp2a3yln8I9AT7SGmYVh0jTrxshuYnmu5KwxRTaR9k0FAwlmI38chPw2DplS2jk-8FpDDZdy0hs0_p7zGdI3xemq5OpF1WXeXvfCSRKAA8P4C7YBKp4GA-qEGv3gJE1HjXEaR1VHjVGPF8crn3H_EuhEWEBRnEpQMk1HN-nfUKwF2cv97fJ_2Qu_jtkbFK_laclISWIR18SDcMtR27_wuzgQUV6Ll49z3cQw6ZinD0YZcJLjBoGrtDWSqPDRBPYvRF9VEZNpmRasL6vU7W037BCoccDwrcCeVsFlspDFVDr6PlxrddkvF2USBjc0QTJNb_sDUEEfaEBbCot6wKcQxsBqfFtfHiwRuY3SZEszbMWdeLMyQNOE3rh7pJJRSFURWxYjgoLbV1jDbyQosdS6R9-VepLpiZ1Gc6Lw35cQAD2zsdajJuTBP-lih3fLxsxw9OuQqsFfpXpXQAUQ0owzjpbLWdy4O-bNM4zbVQttz-kWDwNFD4JL57SbUIm6LAjNlhxhJeYSZGE7SvaxPZ93WWm-VV7PIWiEmFZy5X981rUGMRpxJSpwHMCTpwLgV_LabMHoJd-EDXQjN6w6BDIqC4yVV15yBDBmWO6t_CcCgTNgu7-lpL671g03LW14MChkwt7EGLXNAYi9gHKOP8e69aT2zrCT-3FwMg4wmMpaPMqt62YnGTIJ0zoRlLHn8Jl0uuE6PTFycusBTdmOLjTui1urTW_a5sI98TuY4Jx1uNaRpxbxmUBK357gXy3bYOgwzqGA8i_w4goq-QKEIwjlZRsaLQkDMZaxHQF6mR6ehjQWJ5PFS0IRFk5IRJINKjwsldqzO7lM-8Ill-wqVRRQy2W111k4vtsYn3ymYDZ9SOwu3clx5HrWr_viE7_-WeJnMRL0DHQZD2ZBcrqoZWp1LAtcreKZzvgpiP7nGd-sU2JLqUlA9u1HbLwe7LTuEtoMuCpW_PZ4kgyauQTro6W1qZNkeCz1-nIiptMdrCWE4PeHF3pbuD4srkDS61eiOMGSey-ZprTorH92Egc0DQf-obzkjWw_8A_isfl3pQ )
Theres没有JSON,只有这个字符串。下一步是什么?
感谢。
答案 0 :(得分:1)
没有JSON,只有这个字符串。只有这个字符串。下一步是什么?
通过 g-recaptcha-response 值提交POST到https://www.google.com/recaptcha/api/siteverify并使用reCaptcha 密钥 ,您已经获得了成功回复JSON 强>:
{
"success": true|false,
"challenge_ts": timestamp, // timestamp of the challenge load
"hostname": string, // the hostname of the site where the reCAPTCHA was solved
"error-codes": [...] // optional
}
因此,这是您对 g-recaptcha-response 值的验证。现在,您将成功参数值( true / false )包含在Web表单中以提交或使用服务器端(因为您已获得 g-recaptcha-response 值通过您的服务器请求谷歌服务器)进一步回应客户 再阅读here。