simplepie

Custom Sort Order with SimplePie

Deadly 提交于 2019-12-24 03:45:09
问题 Using SimplePie, how can I sort items by random order and title (alphabetic)? According to this page (http://simplepie.org/wiki/tutorial/sorting_by_custom_criteria_instead_of_date), the documentation says to extend the class and write your own method. But without some more examples, I don't seem to be able to code it by myself. Currently I take all the feed items and put them into arrays and sort them. However, the default sort order of SimplePie is by date. Thus, if some urls have newer

PHP / Wordpress - Loading a remote XML file

女生的网名这么多〃 提交于 2019-12-23 05:25:46
问题 How can a get a object variable from a remote XML file, for example this one ? In PHP5 it works fine with simplexml_load_file() , but I need this to work in PHP 4 also. How can I do that? Or is there any built-in WordPress function that can load xml files? I tried using the WP's SimplePie class, but I get a weird object variable (with incorectly named fields etc). 回答1: If you want to use the smipleXML functions in PHP4 include this class ( I have used it and it works like a charm) http://www

Getting deprecated error with Simplepie

大城市里の小女人 提交于 2019-12-18 09:01:09
问题 I have installed the latest Simplepie code (1.2.1) and I am using the demo code they provide: <?php require 'simplepie.inc'; $url = 'http://news.google.com/news?ned=us&topic=h&output=rss'; $feed = new SimplePie(); $feed->set_feed_url($url); $feed->init(); // default starting item $start = 0; // default number of items to display. 0 = all $length = 0; // if single item, set start to item number and length to 1 if(isset($_GET['item'])) { $start = $_GET['item']; $length = 1; } // set item link

SimplePie Multiple Feeds Random Order

喜你入骨 提交于 2019-12-13 17:22:45
问题 I am new to SimplePie and was looking through the API and couldn't find what I needed. I need to use Simple Pie to get random articles from multiple feeds. I'll better explain my question: Here's how SimplePie gives me the feed now (in chronological order): Article 1 (CNN) Article 2 (CNN) Article 3 (CNN) Article 4 (CNN) Article 5 (CNN) Article 1 (YAHOO) Article 2 (YAHOO) Article 3 (YAHOO) Article 4 (YAHOO) Article 5 (YAHOO) Article 1 (GOOGLE) Article 2 (GOOGLE) Article 3 (GOOGLE) Article 4

simplepie not parsing google news rss feed

冷暖自知 提交于 2019-12-13 17:07:42
问题 This code works perfectly with any other rss feed but not with google news feeds. I do not know what I am doing wrong, I think it's some bug. I keep getting this error when I try to read google news feeds This XML document is invalid, likely due to invalid characters. XML error: SYSTEM or PUBLIC, the URI is missing at line 1, column 61 For example if we try the http://stackoverflow.com/feeds feeds it works nicely, but not with google news feeds. Can some one give me a hint? <?php //get the

PHP access to iTunes tags in an RSS feed

北战南征 提交于 2019-12-12 09:26:17
问题 I need to get access to the iTunes tags in an RSS feed using PHP. I've used simplepie before for podcast feeds, but I'm not sure how to get the iTunes tags using it. Is there a way to use simplepie to do it or is there a better way? Okay I tried Simple XML. All this (the code below) seems to work $feed = simplexml_load_file('http://sbhosting.com/feed/'); $channel = $feed->channel; $channel_itunes = $channel->children('http://www.itunes.com/dtds/podcast-1.0.dtd'); $summary = $channel_itunes-

Only show images from an RSS feed with PHP

徘徊边缘 提交于 2019-12-11 12:36:52
问题 I'm attempting to parse an rss feed to display images only. I am using a generic wordpress feed and would like to strip out everything that isn't an image. I've been playing around with simplepie and but haven't been able to find a solid way to display images only. I found this old simplepie forum post (http://simplepie.org/support/viewtopic.php?id=643) but was unable to get the code working. I suppose it may just be outdated by now but am unsure. I'm not tied to simplepie but do need to work

PHP Deprecated errors won't disappear on WordPress Dashboard

做~自己de王妃 提交于 2019-12-11 08:23:37
问题 TL;DR : Upgraded PHP on our server which caused a bunch of Deprecated errors to appear in WordPress, tried a number of fixes but the errors won't go away. PHP Version: 5.3.10 WordPress Version: 3.3.2 I have a WordPress installation that has been up and running for a little while now, with no complaint. This week, we upgraded PHP on the server to 5.3.10, after the update, the WordPress Dashboard began filling up with errors like this: Deprecated: Assigning the return value of new by reference

SimplePie Pagination / Cache

亡梦爱人 提交于 2019-12-09 14:10:41
问题 I'm trying to understand the cache'ing features of SimplePie on linux. It never tells us to create a separate mySql database for the RSS feeds, so i'm guessing all the cache is done locally. (in the /httpdocs/ directories ? ) I can't figure out how SimplePie stores it's articles once their imported...(using default install on linux instructions) and how long these articles are stored in the DB. This issue is mostly regarding SimplePie with a simple pagination setup as specified on their site

Why am I getting memory leaks in SimplePie when using $item->get_permalink()?

試著忘記壹切 提交于 2019-12-06 04:38:52
问题 I'm using SimplePie with PHP 5.3 (with gc enabled) to parse my RSS feeds. This works well and without problems when doing something like the following: $simplePie = new SimplePie(); $simplePie->set_feed_url($rssURL); $simplePie->enable_cache(false); $simplePie->set_max_checked_feeds(10); $simplePie->set_item_limit(0); $simplePie->init(); $simplePie->handle_content_type(); foreach ($simplePie->get_items() as $key => $item) { $item->get_date("Y-m-d H:i:s"); $item->get_id(); $item->get_title();