-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecaptcha-server.php
More file actions
37 lines (32 loc) · 868 Bytes
/
recaptcha-server.php
File metadata and controls
37 lines (32 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html>
<head>
<title>reCAPTCHA demo: Server side - verify input</title>
</head>
<body>
<h1><strong>reCAPTCHA DEMO</strong></h1>
<?php
if (isset($_POST[email]))
{
$serverSecret='YOUR-PRIVATE-KEY-SEE-GOOGLE-SITE';
$queryUrl= 'https://www.google.com/recaptcha/api/siteverify?secret='.$serverSecret.'&response='.$_POST[responsePost].'&remoteip='.$_SERVER['REMOTE_ADDR'];
$responseJson = file_get_contents($queryUrl);
if (strpos($responseJson, '"success": true'))
{
echo '<p>SUCCESS: You submitted:<br>';
echo 'eMail='.$_POST[email].'<br>';
echo '</p>';
}
else
{
echo '<p>FAILURE: Captcha Error<br>';
echo 'Error:<br>'.$responseJson;
echo '</p>';
exit();
}
}
?>
<br>
<a href="recaptcha-form.html">Restart</a>
</body>
</html>