reCaptcha not working with Umlaut-Domains mobile

133 views
Skip to first unread message

jumping-blueberry

unread,
Nov 3, 2016, 2:12:55 PM11/3/16
to reCAPTCHA
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

jumping-blueberry

unread,
Nov 3, 2016, 2:14:18 PM11/3/16
to reCAPTCHA
Note: it works on www.brauerei-schoenram.de but not on www.schönramer.com

Seth Munroe

unread,
Nov 7, 2016, 4:51:35 PM11/7/16
to reCAPTCHA
Be sure to register all the domains possible for the reCAPTCHA key. for the one with the oomlat, be sure to use that same character on the domain registration page.

-Seth
Reply all
Reply to author
Forward
0 new messages