$secretkey, 'response' => $_POST['h-captcha-response'] ); $client = new Client(); $response = $client->post("https://hcaptcha.com/siteverify", [ "form_params" => $data ]); $responseData = json_decode($response->getBody()); if($responseData->success) { echo("$contactmail"); } else { echo("Failed to verify Captcha"); }