Skip to content

Instantly share code, notes, and snippets.

@djpate
Created April 15, 2011 08:10
Show Gist options
  • Save djpate/921363 to your computer and use it in GitHub Desktop.
Save djpate/921363 to your computer and use it in GitHub Desktop.
private function verifyCaptcha($challenge,$response){
$handle = curl_init("http://www.google.com/recaptcha/api/verify");
$post = array("privatekey"=>$this->params['reCaptcha_private'],
"remoteip"=> $_SERVER['REMOTE_ADDR'],
"challenge"=>$challenge,
"response"=>$response);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($handle, CURLOPT_POSTFIELDS, $post);
$info = explode("\n",curl_exec($handle));
if( $info[0] == "true" ){
return true;
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment