How to remove hCaptcha response output on website?

526 Views Asked by At

I am using hCaptcha and it is working fine. The only problem is that on top of the website some hCaptcha response is shown after submitting the form.

When the hCaptcha has not been used the response output looks like this:

{"success":false,"error-codes":["missing-input-response"]}

When it has been successful I got a similiar success output.

I don't know where it is coming from. How can this output be disabled or hidden? There is no CSS class around it.

I have used the code integration from here: https://medium.com/@hCaptcha/using-hcaptcha-with-php-fc31884aa9ea, like this:

if ($_POST) {
$data = array(
    'secret' => "123",
    'response' => $_POST['h-captcha-response']
);
$verify = curl_init();
curl_setopt($verify, CURLOPT_URL, "https://hcaptcha.com/siteverify");
curl_setopt($verify, CURLOPT_POST, true);
curl_setopt($verify, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($verify, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($verify);
$responseData = json_decode($response);
if ($responseData->success) {
... }

And I have included this:

<script src='https://www.hCaptcha.com/1/api.js' async defer></script>

The code in dev-tools for a successful response look like this: Screenshot dev-tools HTML

0

There are 0 best solutions below