I have tried many solution but no one can help. I’m using google recaptcha for my laravel project and i’m using this library "buzz/laravel-google-captcha": "^2.2"
Here is it my code in view
<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>
My code in LoginController
public function validateLogin(Request $request){
$this->validate($request, [
$this->username() => 'required',
'password' => 'required',
'g-recaptcha-response' => 'required|captcha',
]);
}
I got an error
file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: Connection timed out
I have tried restart my VPS, i have update my secret-key, i have turn on in configuration allow_url_fopen=On
and allow_url_include=On
I still got the error. Anyone can help me? It works fine in localhost
I’m using centos 7, laravel 5.7
2
Answers
I think you don’t have internet access. Try it with curl for example. Login with SSH and test:
or use telnet
If there is no connection you can’t connect. Then you should check if you have a firewall installed on that system or if you have a firewall in front of your system.
I had a similar issue using the
google/recaptcha
whichbuzz/laravel-google-recaptcha
is based on. Changing the request method has fixed it.I guess you are able to change this in the
buzz/laravel-google-recaptcha
config as well. Here.