SimplePie is neither simple, nor pie
Saturday, August 5th, 2006As I mentioned before, Bloglines sucks. So tonight I was trying to build my own aggregator in an attempt to free myself. As it turns out, freedom can be quite painful. My first stop was to get the basics working. I whipped up a quick OPML parser so I could import my feeds from Bloglines. Once I had that done, I needed a way to fetch the feeds so I could display them. I didn’t care so much about read/unread state (I’ll handle that later), I just wanted to get the very basic guts of a feed reader put together.
So now that I’ve got my list of feeds, I need something to fetch the RSS/ATOM and parse it. I’ve looked at a couple of PHP feed parsers in the past, but decided to give SimplePie a shot. As it turns out, not such a great idea. SimplePie touts their software as “So easy, even your grandmother could.” Sounded awesome, so I installed it. Seemed pretty simple, really. Download the tarball, unzip it, get out a single PHP file, include that in your PHP script and then call their library. It was easy…a little too easy.
I first noticed something was up when I output feed items that had embedded images. None of them were showing up. I figured it must be some anti-hotlinking stuff in action, so I browsed over to my feed (which has no hotlink protection). Same, images still didn’t show up. I viewed the HTML source and noticed all of my image URLs had been URL encoded and prefixed by “?i=”. This seemed really odd, so I double checked to make sure that wasn’t showing up in the feed XML. It wasn’t. For some reason, SimplePie was doing it. So I did some searches on their site. After a bit of stumbling about, I found this page. Interesting…they built in a mechanism to work around hotlink blocking. As I dug further, it turned out I had to create a whole other page to handle all image requests. That page would backpost requests to fetch the images and then serve them back to my feed reader.
So I created my image serving page and made the necessary tweaks to the SimplePie configuration to let it know about this new page. Now I ought to be seeing “images.php?i=” instead of “?i=”. I saved my changes and reloaded my browser. Nothing, the images were still broken. So I once again viewed the source. When I looked at the image tags there was still only “?i=”. No reference at all to images.php. What the hell? So I went back to my source and double checked everything, making sure it looked exactly as it did in the SimplePie documentation. Looked fine. Hmm…maybe my browser cache still has the old version of the page. So I did a Shift-reload to clear the cache. Still nothing. Hmm…cache, oh yeah…SimplePie has a cache. But…they wouldn’t dare cache the content transformations would they? So I opened up the cache file and sure enough, they were caching the image tag transformations. I removed the cache file, reloaded my browser and voila! The images popped up perfectly. So as it turns out, the SimplePie installation documents are missing this all important step for anybody who wants to look at something other than broken image icons.
As I thought about it, I realized I really didn’t want hotlink protection. If people were so uptight about hotlinking that they added protection to their images to prevent it, who was I to ignore their wishes? Additionally, serving the images through images.php meant that it was counting against my bandwidth. I wasn’t really crazy about that notion either. So I searched through the SimplePie documentation trying to find anything that would let me disable the hotlink juju. Nada, evidently you get the hotlink stuff whether you want it or not.
So, in conclusion:
- simple = good
- pie = good
- SimplePie = not good
Up next I’ll check out Magpie. What’s up with using “pie” to name everything? Now I can’t stop thinking about pie.


I played around with