- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我的所有代码都准确地设置了 Google 如何记录 API,但它一直返回 bool 值 false,我做错了什么吗?
<?php
if(isset($_POST['sendEmail'])) {
$privateKey = "__my_secret_key__";
$response = $_POST['g-recaptcha-response'];
$remoteip = $_SERVER['REMOTE_ADDR'];
$url = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$privateKey&response=$response&remoteip=$remoteip");
$result = json_decode($url, true);
if($result->success == true) {
$name = strip_tags(trim($_POST['name_1']));
$surname = strip_tags(trim($_POST['surname_1']));
$userArray = [
'name' => $name,
'surname' => $surname,
];
var_dump($userArray);
} else {
echo "reCaptcha failed, please try again...";
}
}
?>
以及我的 HTML 表单,其中包含从 Google 复制的 JavaScript 链接和我收到的数据站点 key :
<html lang="en">
<head>
<meta charset="utf-8">
<title>Recaptcha Example</title>
</head>
<body>
<br>
<br>
<form action="" method="post">
<div class="form-row">
<input name="name_1" placeholder="Your name" type="text">
</div>
<br>
<div class="form-row">
<input name="surname_1" placeholder="Your surname" type="text">
</div>
<br>
<div class="form-row">
<div class="g-recaptcha" data-sitekey="__Site_key__"></div>
</div>
<br>
<input name="sendEmail" type="submit" value="Call me back">
<br>
<h4 id="response"></h4>
</form>
<script src='https://www.google.com/recaptcha/api.js'></script>
</body>
</html>
最佳答案
添加这个脚本:
<script src='https://www.google.com/recaptcha/api.js'></script>
<script>
function get_action(form)
{
var v = grecaptcha.getResponse();
if(v.length == 0)
{
document.getElementById('captcha').innerHTML="You can't leave Captcha Code empty";
return false;
}
else
{
document.getElementById('captcha').innerHTML="Captcha completed";
return true;
}
}
</script>
并在您的提交按钮之前添加此 HTML:
<div class="g-recaptcha" id="rcaptcha" data-sitekey="site key"></div>
<span id="captcha" style="color:red" /></span> <!-- this will show captcha errors -->
关于php - 如何在 html 网络表单上添加 reCaptcha,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42271481/
我在我的一种表单中集成了 reCAPTCHA v3。在 onload 中,右下角有一个生成的 token 和谷歌验证码标志。但是当我提交表单时,在控制台中会显示一个错误,“错误:不存在 reCAPTC
是我还是 recaptcha 图像无法翻译成除 EN 以外的其他语言? 我有 它仍然是英文的。这是故意的吗? 最佳答案 对于 reCAPTCHA 2. 一段时间过去了 这是你的cdn链接看最后,hl参
我正在尝试按照 https://developers.google.com/recaptcha/docs/faq#can-i-use-recaptcha-globally 中的说明在全局范围内使用 r
我们在我们的网站之一中集成了隐形 recaptcha。每当我们提交表单时,它就会自动提交。 我在一些谷歌小组中读到,在边缘浏览器上访问时我们会遇到挑战。但对我们来说,它是自动提交的。 测试隐形reca
我目前使用的是假的开发域而不是 localhost在我的本地机器上,因为我有多个要在本地管理的网站。 Google reCAPTCHA 无法识别我的域,并给我以下错误:ERROR: Invalid d
reCAPTCHA 需要公钥和私钥才能在网站中实现。它还需要 reCAPTCHA key ,具体取决于网站。这背后的原因是什么?公钥和私钥是否会影响 reCAPTCHA 中显示的文字?我知道我可以将公
已关闭。这个问题是 off-topic 。目前不接受答案。 想要改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 已关闭13 年前。 Improve th
我目前使用隐形recaptcha,如果它认为用户是机器人,它会自动显示一个验证码。 现在有了 Recaptcha v3,我很难理解它应该如何使用。 它返回一个分数,但是如果分数很低,这可能表明用户是机
我希望,如果用户(或漫游器)重复做同样的事情,那么Recaptcha v3的得分会下降,但是事实并非如此。 这是从我的日志中摘录的内容,当我在正在构建的网站上登录时尝试使用不同的密码时,该日志是其中的
我有新的隐形 recaptcha 工作正常,但它把徽章放在左下角或右下角。您可以使用“data-badge='inline'”覆盖它,并将其拉入表单中。谷歌对如何实际移动它非常含糊。您无法隐藏它,因为
我的网站正在使用 Google reCAPTCHA 控件,但我听说它被阻止了 中国,反正我看到有人报告说将 API 更改为 https://www.recaptcha.net在中国工作? Anyone
我面临以下情况:当用户点击提交按钮时,应用会禁用该按钮。然后,当 ReCaptcha 的回调函数被调用时,我可以再次启用该按钮。但是如果用户关闭验证窗口我怎么知道然后再次启用我的按钮? 最佳答案 我在
在 reCAPTCHA v3 文档中,它说 reCAPTCHA works best when it has the most context about interactions with your
我正在尝试在我的网站上呈现 google reCaptcha。我去了google reCaptcha admin ,设置标签,并添加两个域:一个是localhost,另一个是mydomain.com。
我已登录我的 Google 帐户,并导航到 reCaptcha 设置页面。但它显示的只是创建新 reCaptcha 帐户的表单。 我想我曾经能够为我的不同域找到我以前的帐户设置,但现在似乎没有任何地方
ReCaptcha v3 将不再提供验证码,而是依靠浏览器指纹识别和谷歌可以获得的有关您的其他信息。 这是一个测试:https://recaptcha-demo.appspot.com/recaptc
google recaptcha 创建了一个没有可访问性属性的 textarea,例如 aria-label。这导致 recaptcha 无法通过 Siteimprove 进行可访问性扫描。 我已经尝
我正在我的一个网站上实现 reCAPTCHA,并且我已经成功实现了它。它工作正常。有时仅通过单击“我不是机器人”才能完成 reCAPTCHA,但有时它会显示图像网格以选择正确的图像并完成验证码。 我只
我已经在我的网站上实现了 reCaptcha,但每当我测试它时,我都会尝试 3-5 次才能成功。我认为我的用户不会喜欢这个。我注意到有些网站有诸如“2 + 2 是什么?”之类的问题。类似的东西同样有效
我在 Angular+Spring MVC 应用程序中使用 Google reCaptcha 进行用户登录。我想知道谷歌是否对其每天(或周/月/年)支持的点击次数有任何限制。 最佳答案 首先,我建议您
我是一名优秀的程序员,十分优秀!