无法从MAMP中的https阅读供稿

时间:2019-02-02 14:12:54

标签: php curl https

我目前在Mac上安装了PHP 5.6.10。我尝试使用启用了https的网站上的以下代码来提取数据:

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$url = "https://deshsanchar.com/feed";
file_put_contents("temp.xml", fopen($url, 'r'));
?>

但是,该页面显示以下警告,并带有空的temp.xml文件:

  

警告:加载cafile流失败:第6行/Applications/MAMP/htdocs/news/index.php中的“⁨/⁨Applications/MAMP⁩/⁨htdocs⁩/ cacert-2019-01-23.pem” < / p>      

警告:fopen():无法在第6行的/Applications/MAMP/htdocs/news/index.php中启用加密

     

警告:fopen(https://deshsanchar.com/feed):无法打开流:在第6行的/Applications/MAMP/htdocs/news/index.php中操作失败

我已经从https://curl.haxx.se/docs/caextract.html下载了cacert-2019-01-23.pem文件,并将其保存在⁨Applications/MAMP⁩/⁨htdocs⁩/目录下,并在php.ini中添加了一些代码:

extension=php_openssl.dll
allow_url_include = On
curl.cainfo=⁨/⁨Applications/MAMP⁩/⁨htdocs⁩/cacert-2019-01-23.pem
openssl.cafile=⁨/⁨Applications/MAMP⁩/⁨htdocs⁩/cacert-2019-01-23.pem

我重新启动了MAMP服务器,但无法正常工作。

0 个答案:

没有答案