Created
May 14, 2018 13:51
-
-
Save luckydevilru/9e6fd350c51b2f58a2c4a4746ef2f831 to your computer and use it in GitHub Desktop.
google recaptcha 2
This file contains hidden or 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
| if ( !$_POST['g-recaptcha-response'] ) { | |
| exit('Заполнить капчу'); | |
| } | |
| $url = 'https://www.google.com/recaptcha/api/siteverify'; | |
| $key = '********************'; // секретный ключ | |
| $query = $url.'?secret='.$key.'&response='.$_POST['g-recaptcha-response'].'&remoteip='.$_SERVER['REMOTE_ADDR']; | |
| $datas = json_decode( file_get_contents($query) ); | |
| if ( $datas->success == false ) { | |
| exit('Капча введена неверно'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment