Husbandman
Husbandman

Reputation: 41

"wordpress" file_get_contents(): SSL operation failed with code 1

I have a WordPress plugin that I created and it has stopped working because of a certificate error.

file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in

I contacted the inmotionhosting and they said the certificate was fine. The code in question is this:

$op = file_get_contents(plugins_url( '../PRTHSEL_Visualizer.html' , __FILE__ ));

It was suggested that I use an https request to get the file. I have searched but cannot find and answer on how to get a file contents within a WordPress plugin via https.

Upvotes: 1

Views: 1254

Answers (1)

Husbandman
Husbandman

Reputation: 41

The problem was the file_get_contents() was given a url for a local file. Byt changing the path to a local it now works under PHP7. PHP 5 never verified the SSL by default but PHP7 does.

Upvotes: 2

Related Questions