website/public/API/queries/mailAddress.php

22 lines
540 B
PHP
Raw Normal View History

2022-03-08 12:46:06 +01:00
<?php
use GuzzleHttp\Client;
function mailAddress($hCaptchaResponse) {
2022-03-08 15:11:10 +01:00
require "./lib/config.php";
2022-03-08 12:46:06 +01:00
$data = array(
'secret' => $secretkey,
'response' => $hCaptchaResponse
);
$client = new Client();
$response = $client->post("https://hcaptcha.com/siteverify", [
"form_params" => $data
]);
$responseData = json_decode($response->getBody());
if($responseData->success) {
return "$contactmail";
} else {
2022-07-05 12:26:54 +02:00
return "Fehler beim Validieren des Captchas.";
2022-03-08 12:46:06 +01:00
}
}