Google API
PHP - How To Implement Google New ReCAPTCHA Code Example With Demo?
We have to use Google captcha code on our registration and contact form because captcha code prevent spams, bots etc. Google provide us to prevent bots sending form requests that way we can protect our site.
- TAGS
- Google API
- 4.5/5.0
- Last updated 09 September, 2022
- By Admin
So, Today i am going to give you very simple example of how to add google reCAPTCHA code in Core PHP from scratch. In this example you have to generate our own API Site Key and Secret from google account. But If you don't know how to generate then no worry, here is the step to generate API Key. we will create two files one "index.php" file for generate view for layout using bootstrap css, another file "process.php" for check your google captcha is right or wrong. So, it is really simple.
So, let's follow bellow step and after this example you will find layout like as bellow, then you can customize as you want.
Generate Google Site Key and Secret
we require to generate google site key and secret key. If you don't have site key and secret key then you can create from here. First click on this link : Recaptcha Admin
After click you can see bellow view and you need register your site link this way:
Ok, after sucessfully register you can get site key and secret key from like bellow preview
Ok, now you have to copy your site key and paste on index.php file and secret key on process.php file, you can see it's place.
index.php
PHP - Google recaptcha code example Contact US Form
process.php
I hope it can help you...