centos 文件获取内容():无法打开流:联机逾时

xvw2m8pv  于 2022-11-08  发布在  其他
关注(0)|答案(2)|浏览(132)

我已经尝试了许多解决方案,但没有人可以帮助.我正在使用谷歌recaptcha为我的laravel项目,我正在使用这个库"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>

我在LoginController中的代码

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

        ]);
}

出现错误
文件获取内容(https://www.google.com/recaptcha/api/siteverify):无法打开流:联机逾时
我已尝试重新启动我的VPS,我已更新我的密钥,我已在配置中打开allow_url_fopen=Onallow_url_include=On
我仍然得到错误。有人能帮助我吗?它在localhost中工作正常
我用的是Centos 7,Laravel 5.7

rxztt3cl

rxztt3cl1#

我想你没有网络连接。比如用curl试试。用SSH登录并测试:

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

或使用telnet

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

如果没有连接,你就无法连接。那么你应该检查一下你的系统上是否安装了防火墙,或者你的系统前面是否安装了防火墙。

wdebmtf2

wdebmtf22#

我在使用buzz/laravel-google-recaptcha时也遇到了类似的问题,改变请求方法后就解决了这个问题。

$recaptcha = new \ReCaptcha\ReCaptcha('secret', new \ReCaptcha\RequestMethod\CurlPost);

我想你也可以在buzz/laravel-google-recaptcha配置中更改这一点。

相关问题