I’ve tried implementing recaptcha in to my Codeigniter application but it’s throwing an error.
I have loaded my helper:
$this->load->helper('recaptchalib_helper');
My Controller:
$publickey = $this->config->item('recaptchakey');
$data['recaptchakey'] = $publickey;
$return = recaptcha_check_answer($publickey, $_SERVER["REMOTE_ADDR"], $this->input->post("recaptcha_challenge_field"), $this->input->post("recaptcha_response_field"));
if($this->form_validation->run() == FALSE){
$this->load->view('form', $data);
} else {
if(!$return->is_valid) {
echo 'failed';
$this->load->view('form', $data);
} else {
echo 'success';
$this->load->view('form', $data);
}
The recurring error is “invalid-site-private-key” and “incorrect-captcha-sol” – can someone tell me where I am going wrong please? Thanks in advance.
The
invalid-site-private-keyis related to the data you entered in the configuration file. Read more here: https://developers.google.com/recaptcha/docs/verifyThe
incorrect-captcha-solis related to the way your view is built. Read more: Need help with reCAPTCHA – keep getting incorrect-captcha-sol