ی همچین کدی نیاز دارید

کد PHP:
<?php
if (!validateReCaptcha()) {
    die(
'invalid captcha response');
}
function 
validateReCaptcha()
{
    if (empty(
$_POST['g-recaptcha-response'])) {
        return 
false;
    }
    
$post_data http_build_query(
        array(
            
'secret' => 'CAPTCHA_SECRET'//paste your captcha secret here,
            
'response' => $_POST['g-recaptcha-response'],
            
'remoteip' => $_SERVER['REMOTE_ADDR']
        )
    );
    
$opts = array('http' =>
    array(
        
'method'  => 'POST',
        
'header'  => 'Content-type: application/x-www-form-urlencoded',
        
'content' => $post_data
    
));
    
$context  stream_context_create($opts);
    
$response file_get_contents('https://www.google.com/recaptcha/api/siteverify'false$context);
    
$result json_decode($response);
    return (
$result->success === true);
}