title: 46/5000 Remote login using curl php and bypass recaptcha
body: <p>I am looking forward to logging on to a site from php curl. The problem is that to log in, he asks me to pass a google recaptcha. I have previously done this by checking the recaptcha from my platform, but now this captcha has the domain lock and I can't use its "data-sitekey".
  My current code ..</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['g-recaptcha-response'])){
  
      $cookie="cookie.txt"; 
      if(!file_exists($cookie)){
              $fh = fopen($cookie, "w");
              fwrite($fh, "");
              fclose($fh);
      }
          $captcha=$_POST['g-recaptcha-response'];
  
          $postdata = "username=xxx&amp;password=xxx&amp;g-recaptcha-response=$captcha"; 
          $ch = curl_init(); 
          curl_setopt ($ch, CURLOPT_URL, "REMOTE URL LOGIN"); 
          curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
          curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
          curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
          curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
          curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt ($ch, CURLOPT_COOKIE,1);
          curl_setopt ($ch, CURLOPT_COOKIEJAR,$cookie);
          curl_setopt ($ch, CURLOPT_COOKIEFILE,$cookie); 
  
          curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
          curl_setopt ($ch, CURLOPT_POST, 1); 
  
          $result = curl_exec($ch);
  
          echo $result;
  }else{
  ?&gt;
      &lt;script src="//www.google.com/recaptcha/api.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;form method="post" action="" name="signup-form"&gt;
          &lt;center&gt;&lt;div class="g-recaptcha" data-theme="light" data-sitekey="SITEKEYREMOTELOGIN"&gt;&lt;/div&gt;&lt;/center&gt;
          &lt;button type="submit" name="submit"&gt;SUBMIT&lt;/button&gt;
      &lt;/form&gt;
  &lt;?php
  }
  ?&gt;
  </code></pre>