$recaptcha_response = $_POST['recaptcha_response'];
$recaptcha_secret = '6Lf6GCkpAAAAAP-KYybqf_1cNbBqF28oIk4fJ4lB';
$recaptch_url = 'https://www.google.com/recaptcha/api/siteverify';
$recaptcha_params = [
'secret' => $recaptcha_secret,
'response' => $recaptcha_response,
];
$recaptcha = json_decode(file_get_contents($recaptch_url . '?' . http_build_query($recaptcha_params)));
if ($recaptcha->score >= 0.5) {
// ここに成功時の処理を書く
} else {
// ここに失敗時の処理を書く 基本的には何もしなくて良い
}