我正在使用Wordpress(4.8.1)开发一个新网站。我已经安装了WP RSS Aggregator插件(4.11.2),以便从之前现有的Joomla网站(2.5.17)上获取RSS提要。 Wordpress安装在GNU / Linux Debian Stretch(9.1)操作系统上,由Apache(2.4.25)服务器以https语言提供。 Joomla是Squeeze(6.0.10)和Apache(2.2.16);该网站以https格式提供,但似乎它不适用于RSS源(URL是https,但浏览器告诉连接不安全)。 以下是Apache配置的片段:
<VirtualHost *:80>
ServerName intranet.cdg44.fr
ServerAlias i2.cdg44.fr
Redirect permanent / https://intranet.cdg44.fr/
</VirtualHost>
<VirtualHost *:443>
ServerName intranet.cdg44.fr
SSLEngine On
SSLCertificateFile /etc/ssl/certs/cdg44.pem
SSLCertificateKeyFile /etc/ssl/private/ca.key
<Directory />
Options FollowSymLinks
AllowOverride None
AuthType Kerberos
AuthName "Kerberos Login"
KrbMethodNegotiate On
KrbMethodK5Passwd On
KrbAuthRealms CDG44.FR
Krb5KeyTab /etc/krb5.keytab
require valid-user
</Directory>
</VirtualHost>
(对于这两个网站,我使用Negociate进行身份验证)。
WP RSS聚合器插件告诉我:
Failed to fetch the RSS feed. Error: cURL error 60: SSL certificate problem: unable to get local issuer certificate
我可以做些什么来解决我的问题?
编辑:
尝试以编程方式获取RSS源:
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
file_get_contents("https://address.website.com/index.php?option=com_content&view=category&id=27&Itemid=241&format=feed&type=rss");
给出了这个错误(通过xdebug):
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /home/pyledevehat/workspace/intranet/wp-content/themes/themename/functions.php on line 197
我的php.ini配置得很好:
allow_url_fopen = On
答案 0 :(得分:0)
我用这段代码解决了我的问题:
$url = "https://address.website.com/index.php?option=com_content&view=category&id=27&Itemid=241&format=feed&type=rss";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
$content = curl_exec($ch);
curl_close($ch);