所以,我正在尝试使用SimplePie解析RSS源:
http://www.simplifyingthemarket.com/en/feed/?a=309993-7b86574c044e802f54eb1e51505b49f2
注意a = ...参数。这个feed提供了一个RSS feed,它回显了该参数:
<link>http://www.simplifyingthemarket.com/en/2016/11/23/thinking-of-selling-dont-overlook-an-outdated-kitchen-buyers-wont/?a=309993-7b86574c044e802f54eb1e51505b49f2</link>
但是当我从SimplePie请求链接时,该值被剥离 - “a =”仍然存在,但是“=”的部分消失了。我的代码如下:
$feed_url = 'http://www.simplifyingthemarket.com/feed/?a=60500-afb430fdef66a9669353bcb33029bd39';
$fetch_limit = 5;
// Load the correct version
$rss_parser = new SimplePie();
$rss_parser->set_cache_location('/home/httpd/tmp');
$rss_parser->set_cache_duration( 3600 );
$rss_parser->set_feed_url( $feed_url );
$rss_parser->enable_cache(true);
$rss_parser->force_feed(true);
@$rss_parser->init();
$rss_parser->handle_content_type();
$rss_items = $rss_parser->get_items(0, $fetch_limit);
foreach ($rss_items as $post)
{
//print "AUTHOR: " . $post->get_author()->get_name() . "\n";
print "TITLE: " . $post->get_title() . "\n";
print "LINK: " . $post->get_permalink() . "\n";
print "\n";
}
结果:
TITLE: Thinking of Selling? Don’t Overlook an Outdated Kitchen, Buyers Won’t
LINK: http://www.simplifyingthemarket.com/en/2016/11/23/thinking-of-selling-dont-overlook-an-outdated-kitchen-buyers-wont/?a=
TITLE: Why Are Mortgage Interest Rates Increasing?
LINK: http://www.simplifyingthemarket.com/en/2016/11/22/why-are-mortgage-interest-rates-increasing/?a=
TITLE: Winter Is Coming… 5 Reasons to Sell Now!
LINK: http://www.simplifyingthemarket.com/en/2016/11/21/winter-is-coming-5-reasons-to-sell-now/?a=
TITLE: Homes Across the Country Are Selling Fast! [INFOGRAPHIC]
LINK: http://www.simplifyingthemarket.com/en/2016/11/18/homes-across-the-country-are-selling-fast-infographic/?a=
TITLE: From Empty Nest to Full House… Multigenerational Families Are Back!
LINK: http://www.simplifyingthemarket.com/en/2016/11/17/from-empty-nest-to-full-house-multigenerational-families-are-back/?a=
我们在这里做错了吗?
感谢...