How to implement google reCAPTCHA using classic Asp

Asked

Viewed 1,232 times

2

Hello,

I can’t do the implantation of recaptcha using the ASP classic.

The tips of the google site are confusing me and I can not implement. Could someone pass me a "be the bá" with the steps? The keys I already have!

  • 1

    Welcome to Stack Overflow! For the community to help you, it’s important to explain your problem in detail. It would be very interesting to add what you have done so far. : Tour and how to ask a question.

2 answers

1

If you already have the key, you must replace in the code below:

File name: Googlecaptcha.Asp

<%@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 = "6LfUUwgTAAAAAMQy5tz9u1BMSnCQV1CVh5tuBcEF"

        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 "<h3>Response: " & objXML.responseText & "</h3>"

        Set objXML = Nothing
    End If
%>

        <form method="post" action="GoogleCaptcha.asp">
            <!-- ///////////// SUA CHAVE ABAIXO ///////////// -->
            <div class="g-recaptcha" data-sitekey="---CHAVE--"></div>
            <br />
            <input type="submit" value="Try">
        </form>
    </body>
</html>

In operation: http://1click.lv/googlecaptcha.asp

Source: Soen and That article

  • Hello guys, I went behind and managed to do. For what you need I will leave the explanation:

0

I went behind and managed to do it. I only needed to do a validation to redirect according to the google response:

I did the following::

Right after the script: objXML.Send. Type the text below:

'Routine created by geovan Mello, to redirect according to your will Dim Buscatring, Procurachar, Minhapos Searches =objXML.responseText ' String to search Search = "false" ' Search for "false" Worms = Instr(4, Procuretring, Procurachar, 1)

     if MinhaPos = "16" then
     response.Redirect("arquivo_de_erro.asp")
     end if
    Set objXML = Nothing

Browser other questions tagged

You are not signed in. Login or sign up in order to post.