title: Verify reCaptcha V2 : Always false
body: <p>I'm trying to implant reCaptcha V2 of Google in my website (developed in PHP &amp; Wordpress). </p>
  
  <p>I'm trying to verify if the user has checked this Captcha before the submit. </p>
  
  <p>And here is my verification : </p>
  
  <pre><code>&lt;?php
  
  if(isset($_POST['g-recaptcha-response']) &amp;&amp; !empty($_POST['g-recaptcha-response'])){
    $privatekey = $secret;
    $captcha = $_POST['g-recaptcha-response'];
    $url = 'https://www.google.com/recaptcha/api/siteverify';
    $data = array(
        'secret' =&gt; $privatekey,
        'response' =&gt; $captcha,
        'remoteip' =&gt; $_SERVER['REMOTE_ADDR']
    );
  
    $curlConfig = array(
        CURLOPT_URL =&gt; $url,
        CURLOPT_POST =&gt; true,
        CURLOPT_RETURNTRANSFER =&gt; true,
        CURLOPT_POSTFIELDS =&gt; $data
    );
  
    $ch = curl_init();
    curl_setopt_array($ch, $curlConfig);
    $response = curl_exec($ch);
    curl_close($ch);
    $jsonResponse = json_decode($response);
    if ($jsonResponse-&gt;success == true) {
              $succMsg = 'Your contact request have submitted successfully.';
              echo "&lt;script&gt;alert(\"OK\")&lt;/script&gt;";
    }
    else {
        $errMsg = 'Robot verification failed, please try again.';
              echo "&lt;script&gt;alert(\"KO ROBOT\")&lt;/script&gt;";
      }
  }
  else{
  
    $errMsg = 'Please click on the reCAPTCHA box.';
      echo "&lt;script&gt;alert(\"KO CLICK ON BOX\")&lt;/script&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>When I reload the page, or when I submit without checked captcha, or when I checked captcha, it always displays:<code>"KO ROBOT"</code> </p>
  
  <p>I have tried also with <code>"file_get_contents"</code> instead of curl, but I had an SSL error Warning. </p>
  
  <p>Thanks.</p>
  
  <p>UPDATE : </p>
  
  <p>When i do this : </p>
  
  <pre><code>var_dump($jsonResponse);
  </code></pre>
  
  <p>I have this on my page : </p>
  
  <blockquote>
    <p>object(stdClass)#4028 (2) { ["success"]=> bool(false)
    ["error-codes"]=> array(1) { [0]=> string(20) "invalid-input-secret" }
    }</p>
  </blockquote>
  
  <p>UPDATE 2 : </p>
  
  <p>Now i have this, after verification of my secret key : </p>
  
  <blockquote>
    <p>object(stdClass)#4028 (2) { ["success"]=> bool(false)
    ["error-codes"]=> array(1) { [0]=> string(20) "timeout-or-duplicate" }
    }</p>
  </blockquote>