PHP code example of neoan3-apps / hcaptcha

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

    

neoan3-apps / hcaptcha example snippets


   \Neoan3\Apps\Hcapture::setEnvironment([
       'siteKey' => 'your-sitekey',
       'secret' => 'your-secret',
       'apiKey' => 'your-api-key'
   ]); 
   if(isset($_POST['my-form']) && \Neoan3\Apps\Hcapture::isHuman())
   {
       ... do stuff
   }

// Set your own secret key
setSecret(string $value);

// API Key of hCaptcha linked to your account
setApiKey(string $value);

// Secret site key linked to your site
// See: https://docs.hcaptcha.com/api#addnewsitekey
setSiteKey(string $value);

// With an array of environment variables provided, set all of them
// This is a 'shortcut' for all three previous methods
setEnvironment(array $environmentVariables);

// Check if the hCaptcha verification was successful
isHuman();

// Retrieve all statitics of the site corresponding to the 
// provided variables (an error value is returned in case of
// invalid credentials)
stats();