Reputation:
I am pretty new in PHP and moreover in Laravel and I have the following strange problem.
I have developed witha registration form containing a Google reCAPTCHA field, something like this:
<form method="post" action="/registration">
...............................................................
...............................................................
...............................................................
<div class="form-group">
<label>Captcha</label>
<div class="input-group">
{!! app('captcha')->display(); !!}
</div>
</div>
{{csrf_field()}}
<button type="submit" class="btn btn-default">Submit</button>
</form>
So this field shoe the classic "I am not a robot" checkbox.
If I have only to check this checkbox I have no problem when the form is submitted to the controller handling the /registration resource.
This is the controller method (with the related input form validator) that hande this request and that validate the form input:
public function store(Request $request) {
Log::info('store() START');
$data = Input::all();
Log::info('INSERTED DATA: '.implode("|", $data));
$rules = array(
'name' => 'required',
'surname' => 'required',
'login' => 'required',
'email' => 'required|email|confirmed',
//'email_confirmation' => 'required|email|confirmed',
'pass' => 'required|required',
//'passConfirm' => 'required',
'g-recaptcha-response' => 'required|captcha',
);
$validator = Validator::make($data, $rules);
if ($validator->fails()){
return Redirect::to('/registration')->withInput()->withErrors($validator);
}
else{
// Do your stuff.
}
}
If instead is opened the popup asking to chose some specific images, when I submit the form I obtain the following error message:
RequestException in CurlFactory.php line 187:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
in CurlFactory.php line 187
at CurlFactory::createRejection(object(EasyHandle), array('errno' => 60, 'error' => 'SSL certificate problem: unable to get local issuer certificate', 'url' => 'https://www.google.com/recaptcha/api/siteverify', 'content_type' => null, 'http_code' => 0, 'header_size' => 0, 'request_size' => 0, 'filetime' => -1, 'ssl_verify_result' => 20, 'redirect_count' => 0, 'total_time' => 0.079000000000000001, 'namelookup_time' => 0.016, 'connect_time' => 0.032000000000000001, 'pretransfer_time' => 0, 'size_upload' => 0, 'size_download' => 0, 'speed_download' => 0, 'speed_upload' => 0, 'download_content_length' => -1, 'upload_content_length' => -1, 'starttransfer_time' => 0, 'redirect_time' => 0, 'redirect_url' => '', 'primary_ip' => '216.58.212.132', 'certinfo' => array(), 'primary_port' => 443, 'local_ip' => '168.202.22.52', 'local_port' => 50542)) in CurlFactory.php line 150
It enter into the previous store(Request $request) controller method. I think that the problem is related to this validation setting:
'g-recaptcha-response' => 'required|captcha'
because I think that it automatially does a call toward the Google Server to check the captcha (infact in the previous error message it specify this IP that should be related to Google: 216.58.212.132).
So, searching online I found something like this related to this kind of error:
that basically speack abot a cacert.pem file that have to be setted into Apache.
It sasy something like this:
I had the exact same but on Windows & xampp. My solution was as simple as: Follow this link: http://curl.haxx.se/ca/cacert.pem Copy the entire page and save it in a: "cacert.pem"
Then in your php.ini file insert or edit the following line: curl.cainfo = "[pathtothisfile]\cacert.pem"
Problem solved
So from what I have understand thi file (https://curl.haxx.se/ca/cacert-2017-01-18.pem) is a bundle of CA certificates that you use to verify that the server is really the correct site you're talking to.
So the fact that I have not setted this file into my Apache could be the cause of my problem?
If ys what have I to do exactly to set it? I have not undertand what have I to do with this downloaded file.
Upvotes: 5
Views: 9175
Reputation:
Solved by myself, this is THE problem explaination and solution ;-)
Upvotes: 3