1. Go to this page and download the library: Download recaptcha-lib/recaptcha library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
recaptcha-lib / recaptcha example snippets
$captcha = new \ReCaptcha\Captcha();
echo $captcha->displayHTML();
use ReCaptcha\Captcha;
$captcha = new Captcha();
$captcha->setPublicKey('YourPublicKey');
echo $captcha->displayHTML();
use ReCaptcha\Captcha;
$my_config = '/optional/path/to/captcha_config.php';
$captcha = new Captcha();
$captcha->setConfig($my_config);
echo $captcha->displayHTML();
$captcha = new Captcha();
$captcha->setPrivateKey('YourPrivateKey');
if ( !$captcha->isValid() ) {
echo $captcha->getError();
// stop action
} else {
echo 'Captcha Valid!!!';
// do something else
}
$captcha = new Captcha();
$captcha->setPublicKey('YourPublicKey');
$captcha->setPrivateKey('YourPrivateKey');
// only perform when the form is submitted
if ( !$captcha->isValid() ) {
echo $captcha->getError();
}
echo $captcha->displayHTML();
// something else ...
// your KEYs
$CAPTCHA_CONFIG['publicKey'] = '6Ldoa_YourPublicKey';
$CAPTCHA_CONFIG['privateKey'] = '6Ldoa_YourPrivateKey';
// reCAPTCHA options
$CAPTCHA_CONFIG['recaptchaOptions'] = array(
'theme' => 'custom',
'lang' => 'it',
'tabindex' => 0
);
// Enable/Disable when you use reCAPTCHA on SSL site
$CAPTCHA_CONFIG['ssl'] = false;
// Set Server API timeout
$CAPTCHA_CONFIG['timeout'] = 10;
// Set Global config captcha_config.php
$my_config = '/path/to/my/captcha_config.php';
$captcha = new Captcha();
$captcha->setConfig($my_config);
$myCustomLang = '/optional/path/to/file/lang'; // no need trailing slash.
$captcha->setTranslation('fr', $myCustomLang);
$my_options = array(
'custom_theme_widget'=>'recaptcha_widget',
'tabindex' => 0,
'lang' => 'de',
'custom_translations' => array(
'instructions_visual' => 'Geben Sie den angezeigten Text ein',
'instructions_audio' => 'Geben Sie das Gehörte ein:',
'play_again' => 'Wort erneut abspielen ',
'cant_hear_this' => 'Wort als MP3 herunterladen',
'visual_challenge' => 'Captcha abrufen',
'audio_challenge' => 'Audio-Captcha abrufen',
'refresh_btn' => 'Neues Captcha abrufen',
'help_btn' => 'Hilfe',
'incorrect_try_again' => 'Falsch, bitte versuchen Sie es erneut.'
)
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.