title: New Google reCAPTCHA keeps failing to verify with localhost
body: <p>New Google reCAPTCHA
  Using CodeIgniter 2.2.2
  Everytime I try to run my test, it returns a false result after loading for a long time with the following warning message:</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Warning</p>
    
    <p>Message:
    file_get_contents(<a href="https://www.google.com/recaptcha/api/siteverify?secret=PUBLICKEY&amp;response=03AHJ_VuvOwCxIKqGoZXeEOWvDxMjYrBsH9HyWpbxg1YmBTThs8gINjC5yEQOG0fVikDPY3GXemQVrB6DT965o0LARL2rRDP-U6m9Y9DSFdDvz55vwsewe4--m0NfssykJZ3et6zItKH7mNsDIi1LLtPrn7vaQmCGlK3LW2hS4Q8TMDhjTW-tecmCRbonCcTcvMN4gHnWuGzSzUFUlOPxAlSHEvkBHspZb5SnGLNakZ5rrF591LL9SS8NrZErFVO3EySpW_CCG26uDhpMJW5y5B_3nZnBYZqpmf0eIIMy5w3rk2FjJrPw2G8Kj98Cv1B1xJcXBgML7uCnZRmc7WDZhzFoI2JAeuEBNwQkQJvSGXsGLGkewz1ClPiQwzYZRlwEpgo2Zpkri6lrIlNMIc0dtmhM7U172LGELgjbNKFAW29Aq8wTOCwC2tztWlTn_8mq9SrS_mhhs7iaG&amp;remoteip=127.0.0.1" rel="nofollow">https://www.google.com/recaptcha/api/siteverify?secret=PUBLICKEY&amp;response=03AHJ_VuvOwCxIKqGoZXeEOWvDxMjYrBsH9HyWpbxg1YmBTThs8gINjC5yEQOG0fVikDPY3GXemQVrB6DT965o0LARL2rRDP-U6m9Y9DSFdDvz55vwsewe4--m0NfssykJZ3et6zItKH7mNsDIi1LLtPrn7vaQmCGlK3LW2hS4Q8TMDhjTW-tecmCRbonCcTcvMN4gHnWuGzSzUFUlOPxAlSHEvkBHspZb5SnGLNakZ5rrF591LL9SS8NrZErFVO3EySpW_CCG26uDhpMJW5y5B_3nZnBYZqpmf0eIIMy5w3rk2FjJrPw2G8Kj98Cv1B1xJcXBgML7uCnZRmc7WDZhzFoI2JAeuEBNwQkQJvSGXsGLGkewz1ClPiQwzYZRlwEpgo2Zpkri6lrIlNMIc0dtmhM7U172LGELgjbNKFAW29Aq8wTOCwC2tztWlTn_8mq9SrS_mhhs7iaG&amp;remoteip=127.0.0.1</a>):
    failed to open stream: A connection attempt failed because the
    connected party did not properly respond after a period of time, or
    established connection failed because connected host has failed to
    respond.</p>
    
    <p>Filename: controllers/cap.php</p>
  </blockquote>
  
  <p>Here is my html code</p>
  
  <pre><code>  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
    &lt;head&gt;
      &lt;title&gt;TEST&lt;/title&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
  
      &lt;form action="validation" method="post"&gt;
  
        &lt;label for="name"&gt;Name:&lt;/label&gt;
        &lt;input name="name" required&gt;&lt;br /&gt;
  
        &lt;label for="email"&gt;Email:&lt;/label&gt;
        &lt;input name="email" type="email" required&gt;&lt;br /&gt;
  
        &lt;div class="g-recaptcha" data-sitekey="My_Public_Key"&gt;&lt;/div&gt;
  
        &lt;input type="submit" value="Submit" /&gt;
  
      &lt;/form&gt;
  
      &lt;!--js--&gt;
      &lt;script src='https://www.google.com/recaptcha/api.js'&gt;&lt;/script&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is my php file:</p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  class cap extends CI_Controller {
      public function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;helper('url');
          $this-&gt;load-&gt;database();
          $this-&gt;load-&gt;model('users_model', 'user');
          $this-&gt;lang-&gt;load("message",$this-&gt;session-&gt;userdata('language'));
      }
    public function index() {
  
      $this-&gt;load-&gt;view("cap");
    }
      public function validation()
      {
          $email;$comment;$captcha;
          if(isset($_POST['email'])){
            $email=$_POST['email'];
          }if(isset($_POST['comment'])){
            $email=$_POST['comment'];
          }if(isset($_POST['g-recaptcha-response'])){
            $captcha=$_POST['g-recaptcha-response'];
          }
          if(!$captcha){
            echo '&lt;h2&gt;Please check the the captcha form.&lt;/h2&gt;';
            exit;
          }
          remoteip=".$_SERVER['REMOTE_ADDR']);
          $response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=MyPrivateKey&amp;response=".$captcha."&amp;remoteip=".$_SERVER['REMOTE_ADDR']), true);
  
          if($response['success'] == false)
          {
            echo '&lt;h2&gt;Wrong&lt;/h2&gt;';
          }else
          {
            echo '&lt;h2&gt;Correct&lt;/h2&gt;';
          }
      }
  }
  ?&gt;
  </code></pre>
  
  <p>(Of course I generated my public and private key through google api webpage)</p>
  
  <p>Any idea guys? Do I need to turn on curl or something in my php?</p>