Home Blog Archive Internet Captcha on its own page - so it goes

Captcha on its own page - so it goes

  • Oct 26, 2025
  • 608
  • 0

In this practice tip, you will learn how you can use a Captcha on your Website. This allows you to check whether a form of a robot has been completed. In this example, we use the "reCAPTCHA" from Google.

Captcha integration: site register with Google

Can Google's reCAPTCHA, you will need a free Google Account.
  • Call in your Browser the reCAPTCHA Website and register your Website.
reCAPTCHA form

Integration of the Captcha in the Header of the site

Add the following Java script to the Header of your site:

Integration of the DIV-container

A tie the following DIV-Container where the Captcha should appear:
  • You don't [forget website key] with the appropriate website key exchange.
Google's reCAPTCHA embed on your own Website

Check the Captcha response

In order to check whether the Captcha was solved correctly, is transmitted in addition to the form an additional field with the name "g-recaptcha-response". This allows you to query for example in PHP with "$_POST['g-recaptcha-response']". Finally, it must be sent to the URL "https://www.google.com/recaptcha/api/siteverify" a query with the "secret" and "response" to the answer of the Captcha to match with the Google Server. As a response you receive a JSON script, which confirms the accuracy of the Captchas or not. The return values, see the Variable "$data", which you can then process further. So the programming might look like in PHP:
  1. $json = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=[Secret key]&response='.$_POST['g-recaptcha-response']);
  2. $data = json_decode($json);
  3. var_dump($data);
How the Google Captcha "I'm not a robot" to work, we will show you in the next tip.

YOU MAY ALSO LIKE

0 COMMENTS

LEAVE A COMMENT

Human?
1 + 3 =