Showing 1 – 2 of 2 replies
dynsight

I have this installed, and I really […]

dynsight PURCHASED
7 years ago
Hi,

I have this installed, and I really like it. However, I cannot get Google Recaptcha to work. It has an error message (www.dynamicsights.com)

What i did is I put my recaptcha code at the beginning of send_mail.php:

require 'PHPMailer/PHPMailerAutoload.php';

//check the recaptha
$secret="secret codefords";
$response=$_POST["g-recaptcha-response"];
$verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}");
$captcha_success=json_decode($verify);
echo "URL is: https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}";
echo "<p>error codes are". $captcha_success->error-codes."</p>";

if ($captcha_success->success==false) {
echo "post is" & $_POST["g-recaptcha-response"]& "<br/>";
echo "success is: "& $captcha_success;

echo "<p>You are a bot! Go away!</p>";

}

else if ($captcha_success->success==true) {

$host = 'mail.dynamicsights.com';

$username = 'contactform@dynamicsights.com';

....rest of your code, unchanged.

However, it keeps generating an error and does not send form
dynsight
dynsight PURCHASED
7 years ago
Oddly the mail is actually sent, but the Json sends a failure message, and the user is told that there was an error sending message, but there was not
dynsight
dynsight PURCHASED
7 years ago
Okay, I got it work.. I need to remove all echo statements completely.... I am guessing that there is a better way of doing this, and looking forward to your suggestion