I need help to implement the answer Google Recaptcha 2.0.
I've tried a few ways to recover the response after sending the form but not consigui get the answer True.
Follows the example I'm trying:
<%@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>
How do I implement a way to check that Recaptcha were marked?
finally found it after so many search i found it first i use this asp class https://github.com/zhennanzhuce/js/blob/master/js/ueditor/1.4.3/asp/ASPJson.class.asp then to validate the response i use this
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
now the used code is :
<%@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>
Many Thanks to Lankymart, Leonardo Duarte