title: reCaptcha.v2 'undefined index g-recaptcha-response'
body: <p>As in title. I believe my code should work without any <code>notices</code> according to Google's API but apparently it's not. I'm at the moment testing reCaptcha on <code>localhost</code> via <code>XAMPP</code>.</p>
  
  <pre><code>$key = "your key";
  $check = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$key.'&amp;response='.$_POST['g-recaptcha-response']);
  $response = json_decode($key);
  if($response-&gt;success===false){
      $_SESSION['err_bot']="Error";
  }
  </code></pre>
  
  <p>Additionaly i'm receiving <code>Notice</code> in this lane:</p>
  
  <p>"trying to get property of non-object in" <code>if($response-&gt;success===false){</code></p>
  
  <p>I've searched some similar problems and few people had these notices because they had <code>form</code> in <code>table</code>. I'm using <code>fullPage.js</code> which is pretty much about tables. Could this be a problem?</p>
  
  <p><strong>Solved</strong></p>
  
  <pre><code>if(isset($_POST['g-recaptcha-response'])){
      echo verify($_POST['g-recaptcha-response']);
  }
  
  function verify($response){
    $ip = $_SERVER['REMOTE_ADDR'];
    $key = "your key";
    $url = 'https://www.google.com/recaptcha/api/siteverify';
    $full_url = $url.'?secret='.$key.'&amp;response='.$response.'&amp;remoteip='.$ip;
  
    $data = json_decode(file_get_contents($full_url));
    if(isset($data-&gt;success) &amp;&amp; $data-&gt;success == true){
       return true;
    }
    return false;
  }
  </code></pre>