Friday 15 March 2013

[PHP] How to Make Recaptcha

Hello a Little Programmer
Have you seen website registration page lately? See that image where there are texts, words, alphanumeric or phrase that you need to type? That is what we called CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart). Before, if you want to incorporate captcha into your page, you have to make some functions in php to convert your string into an image. And you have to enable image functions
of PHP to generate the image. Not this time! No more hassle. Just use reCAPTCHA

reCAPTCHA is a free, secure and accessible CAPTCHA implementation. Today let us talk on how to incorporate reCAPTCHA to your registration page. I assume that you already know how to make a registration form and that the current task that you are going to do right now is just to integrate reCAPTCHA.

To start with, you have to create a reCAPTCHA account. Follow this link. Once you have created your account, type the domain name. You can choose the “Enable this key on all domains (global key)” if you will be using the key for several domain/websites.

Click the CREATE KEY button. You have to remember your public and private key because you will be using that one in your code. Before we will go back to your code, download this recaptcha library.

Now back to your code. Supposing you have



Insert this code after the Last Name line



See to it that the library is on the same path as your registration page. The $publickey should contain the key that you have from reCAPTCHA.

Once that is done, go to your page that handles the form submitted. Let us say you have all ready the script that will save registrant’s data to your database. You can see my other tutorial here. All you have to do is to inject on the top the


The $privatekey variable should contain the key given to you by reCAPTCHA. Thats it! You have made your registration page as spam-free as possible.

Ok. Simple Right :D I Hope You Enjoy & Happy Coding


Resource Program Here

0 comments:

Post a Comment