我想要使用验证码2.0版,使用PHP,在服务器验证我用这个代码:谷歌验证码用PHP验证
if(isset($_POST['Direccion_Email']) AND ($_POST['enviar'])) {
if(isset($_POST['g-recaptcha-response'])){
$mensaje_error = "";
include 'config-formulario.php';
require_once __DIR__ . '/recaptcha-master/src/autoload.php';
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
if (!$resp->isSuccess()) {
$mensaje_error .= "Control Anti SPAM no es válido <br />";
$errors = $resp->getErrorCodes();
} else {
//DO SOMETHING;
}
但是,当我试图发送一个简单的与我联系名字形成,电子邮件和评论,它返回此警告:
警告:file_get_contents():SSL操作失败,代码为1. OpenSSL错误消息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败/ home/diego/www /systec/scripts/recaptcha-master/src/ReCaptcha/RequestMethod/Post.php上线68
警告:file_get_contents()函数:无法上线使能加密在/home/diego/www/systec/scripts/recaptcha-master/src/ReCaptcha/RequestMethod/Post.php 68
警告:的file_get_contents(https://www.google.com/recaptcha/api/siteverify) :无法打开流:操作失败/ 68/012///systec/script/recaptcha-master/src /ReCaptcha/RequestMethod/Post.php 68行
我在localhost上测试这个。
有任何建议。
谢谢。
这些错误可能会去方式共享主机 - 也许不是添加在SSL证书捆绑你的代码库 –
所以我不能测试我的本地服务器上的应用程序更容易? – diego
可以..如果你真的想 –