how to add recaptcha validation in php

Solutions on MaxInterview for how to add recaptcha validation in php by the best coders in the world

showing results for - "how to add recaptcha validation in php"
Louison
03 Apr 2018
1index.html
2
3<html>
4  <head>
5    <title>Google recapcha demo - Codeforgeek</title>
6    <script src='https://www.google.com/recaptcha/api.js'></script>
7  </head>
8  <body>
9    <h1>Google reCAPTHA Demo</h1>
10    <form id="comment_form" action="form.php" method="post">
11      <input type="email" placeholder="Type your email" size="40"><br><br>
12      <textarea name="comment" rows="8" cols="39"></textarea><br><br>
13      <input type="submit" name="submit" value="Post comment"><br><br>
14      <div class="g-recaptcha" data-sitekey="=== Your site key ==="></div>
15    </form>
16  </body>
17</html>
18verify.php
19
20<?php
21    $email; $comment; $captcha;
22
23    if(isset($_POST['email']))
24        $email=$_POST['email'];
25    if(isset($_POST['comment']))
26        $comment=$_POST['comment'];
27    if(isset($_POST['g-recaptcha-response']))
28        $captcha=$_POST['g-recaptcha-response'];
29
30    if(!$captcha){
31        echo '<h2>Please check the the captcha form.</h2>';
32        exit;
33    }
34
35    $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=YOUR SECRET KEY&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']), true);
36    if($response['success'] == false)
37    {
38        echo '<h2>You are spammer ! Get the @$%K out</h2>';
39    }
40    else
41    {
42        echo '<h2>Thanks for posting comment.</h2>';
43    }
44?>
queries leading to this page
verify google recptcha phpphp recaptchahow to add recaptcha validation in phphow to implement google re captcha in php formlaravel recaptcha validationrecaptcha v2 validation phpgoogle recaptcha phphow to add google recaptcha in phpphp google recaptchaadd google captcha phprecapthca php functionrecaptcha validation in phpsimple recapcha phpimplement google recaptcha phpgoogle captcha v2 php examplephp form recaptcharecaptcha php codegoogle captcha php codehow to validate recaptcha phpgoogle captcha v2 phphow to create v3 recaptcha validation step by step in phpgoogle captcha syntaxgoogle recaptcha v2 validation phpphp code to implement google captchagoogle captcha phpphp code for google captcha verificationhow to add recaptcha phpadd recaptcha to php formrecaptcha php formhow to validate recaptcha in phprecaptcha php loginhow to use google captcha in phpphp captcha googlerecaptcha phprecaptcha v2 php validationgoogle recaptcha in php formadding recaptcha to your site phpphp recaptcha validatehowto userecaptchain phpgoogle recaptcha in phpadd recaptacha in html phprecaptcha php validationphp make recaptchamost basic number adding recaptcha phpgoogle captcha example in phpphp add captchagoogle recaptcha verify response phphow to add 2capatcha to a website in phphow to make google recaptcha appear after filling email address how to embed google recaptcha secret key in php mailrecaptcha v3 validation phpcaptcha server side validation in php codehow to use recaptcha in phpsimple recaptcha phpadd google recpatcha v2 in php form add captcha phphow to implement recaptcha with phprecaptcha implementation phphow to setup recapthca for phphow to add recaptcha in phpphp validate recaptchaphp how to add recaptchaadding recaptcha3 to your site phphow to display google recaptcha after entering the details in formcaptcha in php googlehow to add recaptcha to phprecaptcha php integration step by stepgoogle recaptcha v2 php examplerecaptch validation in phphow to use google captcha in phoadding recaptcha 3 to your site phphow to add recaptcha validation in php