我需要帮助来实现答案 Google Recaptcha 2.0。
我尝试了几种方法来在发送表单后恢复响应,但没有 consigui 得到答案 True。
遵循我正在尝试的示例:
<%@LANGUAGE=VBSCRIPT%>
<%
Option Explicit
%>
<html>
<head>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<%
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Dim recaptcha_secret, sendstring, objXML
' Secret key
recaptcha_secret = "xxxxxxxxxxsec"
sendstring = "https://www.google.com/recaptcha/api/siteverify?secret=" & recaptcha_secret & "&response=" & Request.form("g-recaptcha-response")
Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXML.Open "GET", sendstring, False
objXML.Send
Response.write "<br><h3>Response: " & objXML.responseText & "</h3><br>"
Set objXML = Nothing
END If
%>
<form method="post" action="">
<!-- Site key -->
<div class="g-recaptcha" data-sitekey="xxxxxxxxxx"></div>
<br />
<input type="submit" value="Try">
</form>
</body>
</html>
如何实现一种方法来检查 Recaptcha 是否被标记?
经过这么多搜索终于找到了我首先找到它我使用这个asp类https://github.com/zhennanzhuce/js/blob/master/js/ueditor/1.4.3/asp/ASPJson.class.asp然后验证我用这个的回应
result = (objXML.responseText)
Set oJSON = New aspJSON
oJSON.loadJSON(result)
Set objXML = Nothing
success = oJSON.data("success")
if success = "True" then
action = "go to next page"
else
action = ""
end if
现在使用的代码是:
<%@LANGUAGE=VBSCRIPT%>
<%
Option Explicit
%>
<html>
<head>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<!-- #include file="aspJSON.asp"-->
<%
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Dim recaptcha_secret, sendstring, objXML
' Secret key
recaptcha_secret = "XXXCCCXXXX"
sendstring = "https://www.google.com/recaptcha/api/siteverify?onload=onloadCallback&render=explicit&secret=" & recaptcha_secret & "&response=" & Request.form("g-recaptcha-response")
Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXML.Open "GET", sendstring, False
objXML.Send
dim result, oJSON, success, action, errorCapatcha, errorMsg
result = (objXML.responseText)
Set oJSON = New aspJSON
oJSON.loadJSON(result)
Set objXML = Nothing
success = oJSON.data("success")
if success = "True" then
action = "go to next page"
else
action = "do nothing"
end if
END If
%>
<form method="post" action="">
<!-- Site key -->
<div class="g-recaptcha" data-sitekey="XXXXXXXXX"></div>
<br />
<input type="submit" value="Try">
</form>
</body>
非常感谢 Lankymart,Leonardo Duarte
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句