File_get_contents(https://www.google.com/recaptcha/api/siteverify):无法打开流:连接超时 [英] file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: Connection timed out

查看:63
本文介绍了File_get_contents(https://www.google.com/recaptcha/api/siteverify):无法打开流:连接超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试了很多办法,但没人能帮上忙。我正在为我的laravel项目使用Google reCAPTCHA,我正在使用这个库"buzz/laravel-google-captcha": "^2.2"

这是我的代码在视图中吗

<div class="col-md-6">
   @php($attributes = [])
      {!! Form::captcha($attributes) !!}
      @if ($errors->has('g-recaptcha-response'))
         <span class="invalid-feedback" style="display: block;">
                <strong>{{ $errors->first('g-recaptcha-response') }}</strong>
         </span>
      @endif
</div>

我在登录控制器中的代码

public function validateLogin(Request $request){
        $this->validate($request, [
            $this->username() => 'required',
            'password' => 'required',
            'g-recaptcha-response' => 'required|captcha',

        ]);
}

我收到一个错误

FILE_GET_CONTENTS(https://www.google.com/recaptcha/api/siteverify):无法打开流:连接超时

我已尝试重新启动我的VPS,我已更新我的密钥,我已在配置allow_url_fopen=Onallow_url_include=On中打开

我仍然收到错误。有人能帮我吗?它在本地主机中运行良好

我使用的是centos 7,laravel 5.7

推荐答案

我认为您没有Internet访问权限。例如,试着用卷发来搭配它。使用SSH登录并测试:

curl https://www.google.com/recaptcha/api/siteverify

或使用telnet

telnet https://www.google.com/recaptcha/api/siteverify 443

如果没有连接,则无法连接。然后,您应该检查该系统上是否安装了防火墙,或者您的系统前面是否安装了防火墙。

这篇关于File_get_contents(https://www.google.com/recaptcha/api/siteverify):无法打开流:连接超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆