title: Integrating google reCaptcha into an existing payment form
body: <p>recently my site has been receiving a lot of spam through my payments form and I've decided I need to add a <code>captcha</code> in order to prevent this.</p>
  
  <p>I was looking at a few options and I decided to go with Googles <code>reCaptcha</code>. It seems easy enough to set up and use but I've been running into a few problems. </p>
  
  <p>Firstly I've included this <code>script</code> in the header of the form:</p>
  
  <pre><code>&lt;script src='https://www.google.com/recaptcha/api.js'&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I've then included the actually <code>captcha</code> itself at the foot of the form:</p>
  
  <pre><code>&lt;div class="g-recaptcha" data-sitekey="6LdOVv4SAAAAAJ4muJvo_vD7vsd9T9QIfkEwcO7y"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>When I submit the form I do the following:</p>
  
  <pre><code>$captcha = $_POST["g-recaptcha-response"]; //Get Captcha token
  $secret_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; //Get Secret key
  $google_response = http_get("https://www.google.com/recaptcha/api/siteverify", array("secret"=&gt;$secret, "response"=&gt;$captcha), $info); //perform Get request
  print_r($info);
  </code></pre>
  
  <p>But nothing is happening, in fact the page which used to work just hangs and doesn't even display an error message. Any ideas what I might be doing wrong? From my understanding of the documentation, the response will be in <code>JSON</code> and success will either be true or false, I'd like to continue with the payment if true or stop and return to the form if false. </p>
  
  <p>any help is much appreciated. Or if anyone has an alternative solution to adding a captcha I'd be willing to look into that. </p>