Using HTTPS link with php methods (file_get_contents, getimagesize)
Judging from the error you received (SSL23_GET_SERVER_HELLO:unknown protocol) this is almost certainly caused by the server having a newer version of SSL than your client.
The server is probably using a version >= 1.0.0, while you are using 0.9.8c
Your version of SSL is from 2006. Take a look at the list of vulnerabilities in OpenSSL in the last 5 years, as a reason for you to upgrade.
Lots of other people have reported similar experiences . Also here and here.
F2000
Updated on June 14, 2022Comments
-
F2000 almost 2 years
I get a problem when I try to read some HTTPS url in my website.
If I use "http", there is no problem (with file_get_contents and curl), but when I remplace "http" by "https", these methods don't work.
I get some errors:
failed to open stream: operation failed occured Failed to enable crypto occured SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
In my browser, all methods work: https://ssl10.ovh.net/~fyprbqhq/_perso/facebook.myclimb/test.php (Display should show "OK")
In phpinfo() I got:
openssl OpenSSL support enabled OpenSSL Version OpenSSL 0.9.8c 05 Sep 2006
If you have any ideas.
Thanks for help.
(Ps: get_headers() don't work too with https in my case)
More info:
file_get_contents:
$data = file_get_contents("https://ssl10.ovh.net/~fyprbqhq/_perso/facebook.myclimb/test.php");
Curl:
$curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, "http://ssl10.ovh.net/~fyprbqhq/_perso/facebook.myclimb/test.php"); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false); $data = curl_exec($curl_handle); curl_close($curl_handle);