Mail me:

Codeigniter library class for Google reCAPTCHA


A free Codeigniter library class to verify a Google reCAPTCHA response.

How to use:

  1. Place the included Recaptcha.php into your application/libraries folder.
  2. Load the library, passing your reCAPTCHA secret:
    $this->load->library('recaptcha', array('secret' => '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'));
    You can optionally pass 'ssl_verify_peer' => FALSE in the parameters array to turn off CURL's CURLOPT_SSL_VERIFYPEER parameter during testing on server's without verifiable certificates. You should not turn off CURLOPT_SSL_VERIFYPEER on production servers!
  3. Call the library's verify method, passing the reCAPTCHA's response token:
    $result = $this->recaptcha->verify($this->input->post('g-recaptcha-response'));
  4. The verify function's return will be TRUE when the token is verified (via Google's API) and FALSE when not.

The download includes example code.

Download Now