Backend Solution Response Verification

After the user solves their captcha, you can use the ez-captcha-response parameter to validate their captcha solution. You may also get the verification response value dynamically as described in the Frontend Widget Setup.

Verifying a captcha solution response is simple and straightforward.

Verification URL: https://api.easycaptcha.io/verify-solution?secret_key=YOUR_SECRET_KEY&verification_code=EZ_CAPTCHA_RESPONSE

In return, you can expect a response such as these.

{
  "message": null,
  "verification": {
  	"success": true
  },
  "code": 200,
  "success": true
}
{
  "message": null,
  "verification": {
  	"success": false
  },
  "code": 200,
  "success": true
}
{
  "code": 1007,
  "message": "The Secret Key you have used is not valid.",
  "success": false
}

You can use the following code snippets to get an idea of how to verify the captcha response.

<?php
  
$ez_captcha_response = $_POST['ez-captcha-response'];

$response = file_get_contents("https://api.easycaptcha.io/verify-solution?secret_key=" . YOUR_SECRET_KEY . "&verification_code=" . $ez_captcha_response);

$json = json_decode($response, true);

$status = $json['verification']['success'];

if ($status === true) {
  
  echo 'Great work! The captcha response was good.';
  
} else {
  
    echo 'Great work! The captcha response was bad.';

}