我正在尝试在另一个网站上预览来自rss feed的最新帖子.Feed是UTF-8编码的,而网站是ISO-8859-1编码的.在显示标题时,我正在使用;
$post_title = 'Blogging – does it pay the bills?';
echo mb_convert_encoding($post_title, 'iso-8859-1','utf-8');
// returns: Blogging ? does it pay the bills?
// expected: Blogging - does it pay the bills?
Run Code Online (Sandbox Code Playgroud)
请注意,我期待的连字符不是正常的减号,而是一些大笨钟.好吧,反正还要几个像素.:)不确定如何描述它,因为我的键盘无法生成该字符...
我在一些浏览器中看到过(例如Firefox),只有当页面包含RSS/Atom提要时才会激活RSS提要图标.浏览器如何检测页面是否包含Feed?
iOS/Objective C有一个很好的RSS阅读器库吗?
我的页面上有一个RSS链接,实际上是对输出xml的servlet的引用,应该将其视为RSS.发生的事情是它加载了servlet,它只是在浏览器中显示XML.通常这是因为你将你的RSS文件链接为"whatever.rss",但在这种情况下,它是一个服务它的servlet.我如何告诉浏览器它应该被视为.rss?servlet可以加载带扩展名的页面吗?或者是否有contentType("rss/xml; charset = UTF-8"); 类似的类型标记,可以直接在servlet中设置?
谢谢,
我不想为feedmyinbox等类似的服务付费.我有一台服务器.那么有任何PHP代码可用吗?
如果在Feed中找到更新,我希望立即通过电子邮件发送.所以脚本执行以下操作.
谢谢
这个问题有两个部分.
第1部分.昨天我有一些代码可以从RSS提要中回显XML的全部内容.然后我从我的php文档中删除它,保存在它上面,我完全在踢自己.
我相信语法是这样的:
$xml = simplexml_load_file($url);
echo $xml;
Run Code Online (Sandbox Code Playgroud)
我再次尝试了它并且它不起作用,所以显然我忘记了正确的语法并且可以使用你的帮助,亲爱的stackoverflow问题回答者.
我一直想弄清楚我在做什么,我无法在Google或PHP网站上找到一个例子.我试过print_r($ url); 命令,它给了我一个似乎是源的雾化版本.我想要整个弦乐,疣和所有.我意识到我可以在窗口中输入RSS链接并查看它,但是当我编码和编码时,将它放在我的PHP页面上会很有帮助.
第2部分我想重建这个的主要原因是因为我试图从博客RSS解析节点,以便在私有域上托管的网页上显示它.我发布了一个虚拟博客,当我没有为其中一个虚拟帖子添加标题时发现了一个尴尬的格式化故障.
那么在这种情况下做什么呢?我试了一下:
if(entry->title == "")
{$entryTitle = "untitled";}
Run Code Online (Sandbox Code Playgroud)
那根本不起作用.
这是我处理博客的完整PHP脚本:
<?php
/*create variables*/
$subtitle ="";
$entryTitle="";
$html = "";
$pubDate ="";
/*Store RSS feed address in new variable*/
$url = "http://www.blogger.com/feeds/6552111825067891333/posts/default";
/*Retrieve BLOG XML and store it in PHP object*/
$xml = simplexml_load_file($url);
print_r($xml);
/*Parse blog subtitle into HTML and echo it on the page*/
$subtitle .= "<h2 class='blog'>" . $xml->subtitle . "</h2><br />";
echo $subtitle; …Run Code Online (Sandbox Code Playgroud) 我想在我的Rails应用程序中显示华盛顿邮政政治RSS提要.
wp_url = 'http://feeds.washingtonpost.com/rss/politics'
open(wp_url) do |rss|
@wp_feed = RSS::Parser.parse(rss)
end
Run Code Online (Sandbox Code Playgroud)
使用该代码,我收到错误:
attribute <url> is missing in tag <source>
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
找到关于如何检查字符串列表是否在一行内的这个很好的答案如何检查 一行是否有列表中的一个字符串?
但是尝试用dict中的键做类似的事情似乎并不适合我:
import urllib2
url_info = urllib2.urlopen('http://rss.timegenie.com/forex.xml')
currencies = {"DKK": [], "SEK": []}
print currencies.keys()
testCounter = 0
for line in url_info:
if any(countryCode in line for countryCode in currencies.keys()):
testCounter += 1
if "DKK" in line or "SEK" in line:
print line
print "testCounter is %i and should be 2 - if not debug the code" % (testCounter)
Run Code Online (Sandbox Code Playgroud)
输出:
['SEK', 'DKK']
<code>DKK</code>
<code>SEK</code>
testCounter is 377 and should be 2 - if not debug the code
Run Code Online (Sandbox Code Playgroud)
想想也许我的问题是因为.keys() …
使用intentservice获取7 Rss Feed链接的数据,并在后台使用"Google Volley"并使用ResultReceiver获取结果,但我无法配置如何等待凌空响应完成它的工作以触发标记ResultReceiver显示MainActivity中的数据
rss android intentservice android-volley android-intentservice