Joomla

Use joomla default recaptcha plugin in Your Component or Module

1) Get reCaptcha keys from http://www.google.com/recaptcha

2) Set these keys to reCaptcha plugin and activate it if it’s not.

3) Put below code where you want to show reCaptcha

//php code
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onInit','dynamic_recaptcha_1');
//html code inside form tag
<div id="dynamic_recaptcha_1"></div>

4) Put this code where you validating/processing the form

$post = JRequest::get('post');
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$res = $dispatcher->trigger('onCheckAnswer',$post['recaptcha_response_field']);
if(!$res[0]){
die('Invalid Captcha');
}

Joomla
Joomla