PHP code example of phelium / recaptcha

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

    

phelium / recaptcha example snippets


		use Phelium\Component\reCAPTCHA;
	
	$reCAPTCHA = new reCAPTCHA('your site key', 'your secret key');
	
 echo $reCAPTCHA->getScript(); 

	if (isset($_POST['name']))
	{
	    var_dump($_POST);
	
	    if ($reCAPTCHA->isValid($_POST['g-recaptcha-response']))
	    {
	        echo '<br>-- Captcha OK ! --<br>';
	    }
	}
	
 echo $reCAPTCHA->getHtml();