Codeigniter Form Validation with Google reCAPTCHA

Codeigniter Form Validation with Google reCAPTCHA

In this Post We Will Explain About is Codeigniter Form Validation with Google reCAPTCHA With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Integrate reCAPTCHA in Codeigniter Tutorial Example

Also Read This ๐Ÿ‘‰   how to add captcha in login form in codeigniter?

In this post we will show you Best way to implement recaptcha example with codeigniter validation, hear for Integrating Google’s reCaptcha in CodeIgniter’s form validation with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

1 Phase # Get an api key for Web-site from google

integrate_codeigniter_recaptcha_with_codeigniter_validation, We must have google gmail account ,go to this simple link and fill the full form like image. google recaptcha with codeigniter

2 Phase # copy generated api key/h3>

And then we put codeigniter recaptcha input into simple your HTML form and then put your google api source code into it,After that put api link above the same php file.

<div class="g-recaptcha"></div>

3 Phase # Put CI controller put this simple validation methods

function captcha_validation_google() {
    $google_captcha = $this->input->post('g-recaptcha-response');
    $response_google = file_get_contents(" &response=" . $google_captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']);
    if ($response_google . 'success' == false) {
        return FALSE;
    } else {
        return TRUE;

after thet you can simple use curl if all the data content php function Like as a file_get_contents not supported by your any linux or more hosting provider simple like this example

function captcha_validation_google() {
    $recaptcha_google = trim($this->input->post('g-recaptcha-response'));
    $userIp_google= $this->input->ip_address();
    // put your google secret key hear
    $data_google_captcha = array(
        'secret' => "$google_secret",
        'response' => "$recaptcha_google",
        'remoteip' =>"$userIp_google"
    $live_captcha_verfy = curl_init();
    curl_setopt($live_captcha_verfy, CURLOPT_URL, "");
    curl_setopt($live_captcha_verfy, CURLOPT_POST, true);
    curl_setopt($live_captcha_verfy, CURLOPT_POSTFIELDS, http_build_query($data_google_captcha));
    curl_setopt($live_captcha_verfy, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($live_captcha_verfy, CURLOPT_RETURNTRANSFER, true);
    $captcha_response = curl_exec($live_captcha_verfy);
    $status_capcha= json_decode($captcha_response, true);
        return FALSE;
        return TRUE;

And Then create this simple ci validation rule as well as validation message

$this->form_validation->set_rules('g-recaptcha-response', 'recaptcha validation', 'required|callback_validate_captcha');
$this->form_validation->set_message('captcha_validation_google', 'Again Please check your Google the the captcha form');

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example


I hope you have Got What is CodeIgniter 3.0 Form Validation BotDetect CAPTCHA Example And how it works.I would Like to have FeedBack From My Blog( readers.Your Valuable FeedBack,Any Question,or any Comments about This Article( Are Most Always Welcome.