Last active
February 7, 2021 14:39
-
-
Save josephilipraja/3ec08844e9b3ec5acb9f044e3c4ec387 to your computer and use it in GitHub Desktop.
Simple PHP Server-side verification of Google re-Captcha.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])): | |
// Your site secret key obtained from Google | |
$secret = '#####################################'; | |
$grResponse = $_POST['g-recaptcha-response']; | |
// Verify with Google Servers | |
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$grResponse); | |
$responseData = json_decode($verifyResponse); | |
if($responseData->success): | |
// VERIFICATION SUCCESS | |
else: | |
// VERIFICATION FAILED | |
endif; | |
else: | |
// INVALID REQUEST | |
endif; | |
?> |
kamleshwebtech
commented
Jan 19, 2019
•
<title>Check Re-captcha</title>
<style>
.form-wrapper-outer{
padding: 40px;
border-radius: 8px;
margin: auto;
width: 460px;
border: 1px solid #DADCE0;
margin-top: 7%;
}
</style>
</script>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment