I am currently working on a website, and I've had some problems with spammers on my comment system. So, I am implementing a reCAPTCHA (maybe some scanners later). I have registered my site with Google, and now I have embedded the code. But, I need to get the result (not checked, succeeded, failed) of my reCAPTCHA in PHP, since I use that language for the comment system. How can I do this?

  • If you're using Google recaptcha then they have code examples you can use
    – Abu Nooh
    Jan 30, 2016 at 1:17
  • 1
    There is this amazing new thing called Google and if you type a phrase like "php recaptcha code example" it tells you where to find it. :P
    – Steve
    Jan 30, 2016 at 1:37
  • Lol im not stupid i have been researching.
    – jadenPete
    Jan 30, 2016 at 1:38
  • I don't understand But, I need to get the result (not checked, succeeded, failed) :D pls tell me if you haven't succeeded with your prob. Feb 3, 2016 at 9:54

2 Answers 2


Sign up for a api key it's free. And use the following code example.



If you are sending captcha request by post method using Curl PHP. You can use the following code by get the respose:

  $privatekey = "paste_your_privatekey";
  $responseKey = $_POST["g-recaptcha-response"];
  $userIP = $_SERVER["REMOTE_ADDR"];

  /////Curl Start///////
  $ch = curl_init();

  curl_setopt($ch, CURLOPT_URL,"https://www.google.com/recaptcha/api/siteverify");
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS,

  // Receive server response ...
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

  $server_output = curl_exec($ch);
  $response = json_decode($server_output);

  //view response
  curl_close ($ch);
  /////Curl Close///////

  // Further processing ...
  if ($response->success == "true") {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.