I made a contactform with a reCaptcha.
The Website has various domains (I already told my client that this is not the best solution because of Duplicate Content)
It works on desktop but not on mobile devices. (I tried with Chrome on a Samsung A3 with Android 6)
So I made a php-array selecting the code depending on the domain.
[php]$recaptcha_code['
www.brauerei-schoenram.de']['public'] = 'abc';
$recaptcha_code['
www.brauerei-schoenram.de']['secret'] = 'def';
$recaptcha_code['
www.xn--schnramer-27a.com']['public'] = 'xyz';
$recaptcha_code['
www.xn--schnramer-27a.com']['secret'] = '123';
$host4google = (strpos($_SERVER['HTTP_HOST'],"www.")!==false)?trim($_SERVER['HTTP_HOST']):'www.'.trim($_SERVER['HTTP_HOST']);
//more code...
/*html for input field
echo "<div class="g-recaptcha" data-sitekey="'.$recaptcha_code[$host4google]['public'].'"></div>";
/*check*/
//Captcha-Check
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
$meldungContactVersand = "Fehler mit dem Captcha";
exit;
}
$response=file_get_contents("
https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_code[$host4google]['secret']."&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
$responseData = json_decode($response);
if ($responseData->success==false)
{
//please confirm that you are no bot
}else
{
//send mail
}
[/php]
I suppose this is a bug or is there a way to make this work?
Thanks in advance