我想显示来自给定的rss feed网址的新闻。但是我没有在数据部分得到任何东西。下面是我从https://github.com/willvincent/feeds尝试并替换了网址的代码。
public function demo() {
$feed = Feeds::make('https://timesofindia.indiatimes.com/rssfeeds/296589292.cms);
$data = array(
'title' => $feed->get_title(),
'permalink' => $feed->get_permalink(),
'items' => $feed->get_items(),
);
return View::make('feed', $data);
}
当我打印$ feed时,我得到以下信息。
SimplePie {#1572 ▼
+data: array:3 [▼
"type" => 0
"links" => []
"items" => []
]
+error: "cURL error 60: SSL certificate problem: unable to get local issuer certificate"
+sanitize: SimplePie_Sanitize {#1573 ▶}
+useragent: "SimplePie/1.5.3 (Feed Parser; http://simplepie.org; Allow like Gecko) Build/20200302054845"
+feed_url: "https://timesofindia.indiatimes.com/rssfeeds/296589292.cms"
+permanent_url: "https://timesofindia.indiatimes.com/rssfeeds/296589292.cms"
+file: null
+raw_data: null
+timeout: 10
+curl_options: []
+force_fsockopen: false
+force_feed: false
+cache: true
+force_cache_fallback: false
+cache_duration: 3600
+autodiscovery_cache_duration: 604800
+cache_location: "D:\Laraveltest\laravelinit_latest_2020_02_17\storage\framework/cache"
+cache_name_function: "md5"
+order_by_date: true
+input_encoding: false
+autodiscovery: 31
+registry: SimplePie_Registry {#1574 ▶}
+max_checked_feeds: 10
+all_discovered_feeds: []
+image_handler: ""
+multifeed_url: []
+multifeed_objects: []
+config_settings: null
+item_limit: 0
+check_modified: false
+strip_attributes: array:14 [▶]
+add_attributes: array:3 [▶]
+strip_htmltags: array:19 [▶]
+enable_exceptions: false
}
[请帮我解决这个问题。
您正在获取证书问题
如果使用XAMPP服务器。您可以从下面的链接下载cacert.pem
文件,并将其放在C:\xampp\php\extras\ssl\cacert.pem
下,并添加其路径php.ini
文件
https://curl.haxx.se/docs/caextract.html
放在这里
C:\xampp\php\extras\ssl\cacert.pem
在您的php.ini中,将此行放在本节中(“ c:\ xampp \ php \ php.ini”:]
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"
重新启动您的Web服务器/ Apache
Laracast -> cURL error 60: SSL certificate problem: unable to get local issuer certificate