- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 SimplePie 1.4.2 的编译版本(GitHub 上最后一个标记版本)聚合一些 rss/atom 提要(如果需要,可以使用下面的代码)。
它在几个基于 Linux 的 Web 主机上运行良好,但是当我将其上传到 Azure app services 时只有 http 提要可以正确显示,但 https 则不能。
为什么会发生这种情况?没有在 Web 应用程序上设置具体设置,在两种环境中都使用 PHP 5.6。通过 http 或 https 访问 azure web 应用程序没有区别。
谢谢大家!
<小时/><?php
date_default_timezone_set('Europe/Rome');
set_time_limit(0);
header('Content-Type: application/rss+xml; charset=UTF-8');
require_once('SimplePie.compiled.php');
[...]
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title><?php echo $feedtitle; ?></title>
<atom:link href="<?php echo $feedlink; ?>" rel="self" type="application/rss+xml" />
<link><?php echo $feedhome; ?></link>
<description><?php echo $feeddesc; ?></description>
<?php
$feed = new SimplePie();
$feed->set_feed_url($feeds);
$feed->force_feed(true);
$feed->init();
$feed->handle_content_type();
foreach($feed->get_items() as $item) {
?>
<item>
<title><?php echo $item->get_title(); ?></title>
<link><?php echo $item->get_permalink(); ?></link>
<guid><?php echo $item->get_permalink(); ?></guid>
<pubDate><?php echo $item->get_date('D, d M Y H:i:s T'); ?></pubDate>
<dc:creator><?php if ($author = $item->get_author()) { echo $author->get_name()." at "; }; ?><?php if ($feed_title = $item->get_feed()->get_title()) {echo $feed_title;}?></dc:creator>
<description><![CDATA[<?php echo $item->get_content(); ?>]]></description>
</item>
<?
};
?>
</channel>
</rss>
最佳答案
它不适用于“https”网址,因为 SimplePie 利用 cURL
来发出 http 请求,而对于 https
请求,则使用 cURL
需要验证主机或对等证书。
您可以尝试以下代码片段来绕过验证。
$simplePie = new SimplePie();
$simplePie->set_curl_options(
array(
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false
)
);
关于php - Azure 上的 SimplePie 不解析 https feed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39637777/
我已经作为发布者向 feedly 提交了一个站点提要。但我没有找到我有多少来自任何地方的订阅者。有什么方法可以检查订阅者数量吗? 最佳答案 尝试输入如下 curl http://cloud.feedl
我正在设计一个 Feeds 系统,一个人可以发布新闻,其他人可以看到彼此的新闻,就像 Twitter 一样。 现在我将新闻保存在 HBase 中,并将它们缓存在 Redis 中。这种方法有 O(1)
我在 atom 文件中显示图像时遇到问题。它不包括谷歌阅读器、歌剧或火狐的提要中的图像。 作为起点,我在 [Atom 1.0 Syndication Format 概述] 中执行了 list 6 中的
我已经构建了一个简单的 Django 照片应用程序。用户可以上传照片、关注其他用户和喜欢照片。为了处理用户之间的关系(关注和取消关注),我使用了一个名为 django-relationships 的包
我需要在网站中显示 Telegram channel 帖子。但我不知道如何将 Telegram channel 导出为 xml。我需要文本和图像以及其他文件和媒体,例如 mp4 - pdf 或其他内容
我正在使用Google Feed JSAPI读取/解析提要。问题是,当提要更改时,之前的条目将变得无效(链接和图像不起作用),因此我无法加载提要的缓存版本。我认为加载提要时会有一个选项不使用缓存版本,
我正在使用 Facebook 页面插件集成 Facebook 页面提要 https://developers.facebook.com/docs/plugins/page-plugin 虽然它几乎适用
我正在用 PHP 构建一个 RSS 提要聚合器/阅读器。由于 RSS 本质上是用户生成的内容,因此我不想依赖提要内容的安全性。 我正在寻求有关清理供稿内容以便在用户设备上存储和显示的建议。目前,我正在
因为我运行一个博客聚合器网站,它每小时检查大量 RSS 提要列表以获取新帖子,所以如果可以使用 google feed api 或 Google AJAX Feed API 我会很高兴而不是让 cro
嘿,我有这两个 RSS 源 - http://www.petrolprices.com/feeds/averages.xml?search_type=town&search_value=kilmarn
我无法使用 Google Feed API 加载图像,我正在使用 mediaGroup 加载图像。 这是我为获取提要而编写的 javascript 代码 google.load("feeds", "
很抱歉,如果之前有人问过这个问题 - 有一个标题相似的问题,但它不完全是我正在寻找的内容。 我正在做的是从数据库中获取结果并将其打印在适当的标签内以创建 RSS Feed。 唯一的问题是文章正文包含
我尝试发布消息来供稿,但她只显示在个人资料中。 如何使此消息显示在新闻源和个人资料源上? 这是我的示例代码: SBJSON *jsonWriter = [[SBJSON new] autoreleas
我正在尝试使用 Google feeds 将 RSS feed 添加到我的网站。问题是它限制了条目的数量。我只看到 4 个条目,但当我 curl RSS 时,我看到 28 个条目。我怎样才能让它加载其
我试图在不使用任何插件的情况下在 jQuery 中构建 rss 提要,我在这里找到了解决方案:designshack.net它使用不再使用的 Google Feed API。我发现解决方案很简单,但它
我从 Node.js 服务器连接到 Google Feed API(使用 https://stackoverflow.com/a/22821516/3303704 )。但每次我使用它时,它似乎都会加载
我正在使用以下代码获取提要: NSDictionary *dirTemp; NSError *error; NSStringEncoding encoding; NSString *strUrl =
为什么我的日历没有将 JSON Feed 中的数据放入我的网页上? $(document).ready(function() { var date = new Date(); var
旧版 Facebook News Feed 和新版之间是否存在问题? 我的位置开放图集合的输出之间存在冲突。 在旧的新闻提要中,我在使用 Open Graph 进行跨平台 checkin 时得到了这个
我正在尝试在 Django (Python) 环境中使用 Amazon API 为产品设置最高价格。我已经通过计算 md5 函数解决了这个问题,该函数的值与 Amazon MWS Scratchpad
我是一名优秀的程序员,十分优秀!