Skip to content

Instantly share code, notes, and snippets.

@DaltonWebDev
Last active March 29, 2020 11:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DaltonWebDev/83a33924258c87de6bf5cad168f622b3 to your computer and use it in GitHub Desktop.
Save DaltonWebDev/83a33924258c87de6bf5cad168f622b3 to your computer and use it in GitHub Desktop.
<?php
$captchaVerification = !empty($_REQUEST["captcha_verification"]) ? $_REQUEST["captcha_verification"] : false;
if ($captchaVerification !== false) {
$data = [
"endpoint" => "verify",
"captcha_verification" => $captchaVerification,
"captcha_difficulty" => 5 // make sure the difficulty matches the diffulty you added to form button
];
$options = [
"http" => [
"method" => "POST",
"user_agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36",
"header" => "Content-Type: application/x-www-form-urlencoded",
"content" => http_build_query($data)
]
];
$context = stream_context_create($options);
$verify = file_get_contents("https://wehatecaptchas.com/api.php", false, $context);
$response = json_decode($verify, true);
$verify = $response["data"]["verified"];
} else {
$verify = false;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment