Is it possible to use googles reCaptcha with forms

2020-04-30 01:34发布

I find https://formspree.io/ really good and easy to use since I can edit my form as much as I like without having to touch a single line of php to process it.

Here´s my form.

                        <form action="//formspree.io/my@email.here" method="POST">
                        <div class="row uniform">
                            <div class="6u 12u$(large) 6u(medium) 12u$(xsmall)">
                                <label for="namn">Namn</label>
                                <input type="text" name="namn" id="namn" required/>
                            </div>
                            <div class="6u$ 12u$(large) 6u$(medium) 12u$(xsmall)">
                                <label for="epost">Epost</label>
                                <input type="email" name="_replyto" id="epost" required/>
                            </div>
                            <div class="12u$">
                                <label for="meddelande">Meddelande</label>
                                <textarea name="meddelande" id="meddelande" rows="5" required></textarea>
                            </div>

                            <div class="6u 12u$(large) 6u(medium) 12u$(xsmall)">
                                <input type="checkbox" id="prenumerera" name="prenumerera">
                                <label for="prenumerera">Prenumerera på mitt nyhetsbrev</label>
                            </div>

                            <div class="6u 12u$(large) 6u(medium) 12u$(xsmall)">
                                <div class="g-recaptcha" data-sitekey="public_site_key"></div>
                            </div>

                            <input type="hidden" name="_next" value="<?php echo $ROOT; ?>./tack.php" />
                            <input type="hidden" name="_subject" value="Kontakt!" />
                            <input type="text" name="_gotcha" style="display:none" />

                            <div class="12u$">
                                <ul class="actions">
                                    <li><input type="submit" value="Skicka" class="special" /></li>
                                    <li><input type="reset" value="Rensa" /></li>
                                </ul>
                            </div>
                        </div>
                    </form>

So.. How can I verify the input from reCaptcha when I don't have to process the form through php?

Thank you!

标签: php recaptcha
2条回答
甜甜的少女心
2楼-- · 2020-04-30 02:28

Formspree now redirects all form submissions to a reCaptcha page before finishing the submission. So there's no need to use the _gotcha anymore unless you pay for Gold level and don't want the reCaptcha functionality.

For more see https://formspree.io/

查看更多
混吃等死
3楼-- · 2020-04-30 02:29

Captcha is not supported by formspree.

What you can do (and what you have done) is add a _gotcha hidden input, so spammer will likely fill it.

If you want a catpcha, you may want to process the form by yourself.

查看更多
登录 后发表回答