PHP code example of adcaptcha / verify-adcaptcha

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

    

adcaptcha / verify-adcaptcha example snippets


composer 



// Use autoload


// Your API key and token
$apiKey = 'secret_key'; // Make sure to store this securely in real applications
$token = 'captcha_success_token';

// Create an instance of the Verify class
$verifier = new Verify();

try {
  // Call the verify method and get the HTTP response code
  $responseCode = $verifier->verify($apiKey, $token);
  $message = isset($responseCode['message']) ? $responseCode['message'] : 'No message found';
  // Output the HTTP response code
  echo "Response Data: $message";

} catch (Exception $e) {
  // Handle the exception
  echo "An error occurred: " . $e->getMessage();
}



| Status Code | Message                |
| ----------- | ---------------------- |
| 200         | Token verified         |
| 400         | Token missing          |
| 400         | Invalid token          |
| 400         | Token already verified |