PHP code example of htmlguyllc / phprecaptcha

1. Go to this page and download the library: Download htmlguyllc/phprecaptcha 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/ */

    

htmlguyllc / phprecaptcha example snippets


 $captcha = new \HTMLGuyLLC\ReCaptcha($secret, $site_key);
 

$captcha = new \HTMLGuyLLC\ReCaptcha();
echo $captcha->display();

try
{
    $captcha = new \HTMLGuyLLC\ReCaptcha();
    if( !$captcha->verify() )
    {
        //user failed to complete the captcha correctly
    }
}
catch(\HTMLGuyLLC\ReCaptchaExeption $e)
{
    //do something specific for errors with recaptcha or this class
}
catch(\Exception $e)
{
    //catch any unexpected exceptions
}