$secret, 'response' => $_POST["g-recaptcha-response"] ); $options = array( 'http' => array ( 'method' => 'POST', 'content' => http_build_query($data) ) ); $context = stream_context_create($options); $verify = file_get_contents($url, false, $context); $captcha_success=json_decode($verify); if ($captcha_success->success==false) { echo "
You are a bot! Go away!
"; } else if ($captcha_success->success==true) { $fromName = stripslashes($_POST["name"]); $fromEmail = stripslashes($_POST["email"]); $subject = "Jrtechs.me Form Submission - " . $fromEmail; $emailMessage = stripslashes($_POST["message"]); $message = "Message from contact form on jrtechs.me\nName: $fromName \nEmail:\n$fromEmail \nMessage:\n$emailMessage"; $headers = "From: $fromEmail"; $response = $_POST[g-recaptcha-response]; mail($toEmail, $subject, $message, $headers); header('Location:https://jrtechs.me/messageSent.html'); } } } }