
[英]PHP: file_get_contents(): SSL operation failed with code 1
[英]PHP file_get_contents() SSL operation failed with code 1
我想用“我是个白痴”作为这个问题的开头,但我真的可以使用一些帮助。
我有一个由 GoDaddy 托管的 PHP 站点。 在过去的几年中,我一直在使用 file_get_contents() 将一个简单的 XML 页面读取到我网站的 mySQL 数据库中。 今年一月,我开始收到以下警告。
Warning: file_get_contents() [function.file-get-contents]: SSL operation failed with code 1. OpenSSL Error messages: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
警告:file_get_contents() [function.file-get-contents]:无法启用加密
Warning: file_get_contents( https://api.competitionsuite.com/2013-02/Competitions/?o=C35091BF-0F25-4C86-A5AA-C7714E38112C ) [function.file-get-contents]: failed to open stream
在此之前,我没有该站点的 SSL 证书,因此我从 GoDaddy 购买了基本证书,希望这可以解决错误,但即使在 HTTPS 站点上,我也会遇到相同的错误。
这是我的代码片段,但如果我需要提供更多信息,请告诉我。
//read XML
$url = 'https://api.competitionsuite.com/2013-02/Competitions/?o=C35091BF-0F25-4C86-A5AA-C7714E38112C';
$context = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));
$xml = file_get_contents($url, false, $context);
$xml = simplexml_load_string($xml);
如果有人有空闲时间,我真的可以使用一些指导。 TIA
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.