使用PHP方法的HTTPS链接(file_get_contents,getimagesize) [英] Using HTTPS link with php methods (file_get_contents, getimagesize)

查看:135
本文介绍了使用PHP方法的HTTPS链接(file_get_contents,getimagesize)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在我的网站上阅读一些HTTPS网址时出现问题。

I get a problem when I try to read some HTTPS url in my website.

如果我使用http,则没有问题(使用file_get_contents和curl ),但是当我用https重新设置http时,这些方法不起作用。

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.

我收到一些错误:

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

在我的浏览器中,全部方法有效:
https://ssl10.ovh.net /~fyprbqhq/_perso/facebook.myclimb/test.php (显示应该显示OK)

In my browser, all methods work: https://ssl10.ovh.net/~fyprbqhq/_perso/facebook.myclimb/test.php (Display should show "OK")

在phpinfo()中我得到了:

In phpinfo() I got:

openssl
OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.8c 05 Sep 2006

如果您有任何想法。

感谢您的帮助。

(Ps:get_headers()在我的情况下也不适用于https)

(Ps: get_headers() don't work too with https in my case)

更多信息:

file_get_contents:

file_get_contents:

$data = file_get_contents("https://ssl10.ovh.net/~fyprbqhq/_perso/facebook.myclimb/test.php");

卷曲:

$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);


推荐答案

从您收到的错误判断(SSL23_GET_SERVER_HELLO:未知协议)这几乎可以肯定是因为服务器拥有比你的客户端更新版本的SSL。

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.

服务器可能正在使用版本> = 1.0.0,而你是使用0.9.8c

The server is probably using a version >= 1.0.0, while you are using 0.9.8c

您的SSL版本是从2006年开始。看看过去5年中OpenSSL中的漏洞列表,作为您升级的原因。

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.

这篇关于使用PHP方法的HTTPS链接(file_get_contents,getimagesize)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆