Search code examples
phpssllaravel-5file-get-contents

file_get_contents from remote client and SSL


I have PHP Laravel5 project. I use file_get_contents() in a controller's action like the following:

$production = json_decode(file_get_contents(url('/operation/get-production/'.$job->id)))->production;

The above route is excluded from authentication and authorization and the above line of code works well from the localhost. However, when a remote user from the Internet uses that code, it generates the following error:

enter image description here

I'm not using IIS, the server is Apache on Ubuntu linux. I don't know why SSL is appeared in this case? I'm pretty sure that the URL supplied to the function is http://... not https://...


Solution

  • It sounds like the certificate verification is failing because it doesn't have a reference file of root certificates to check it with. See this Stack Overflow answer.