I’ve just finished a so called drop in replacement for the snoopy library. I grabbed a RSS aggregater from the planet-php site. The aggregater was using magpierss, which in its place was using snoopy to get the RSS feeds. Unfortunately the whole snoopy library is a bit outdated (the magpierss as well). This shouldn’t be a problem, but I ran in to a few anyway.

The first problem I had was that snoopy always got a time out when fetching content from a server with keep-alive enabled. It should look at the ‘Content-Length’ header, but it doesn’t. Second was that fetching data which was send chunked, header ‘Transfer-Encoding: Chunked’, didn’t arrive well at all. The sizes are send before each chunk, which made them end up in the result. That of course, made the whole XML invalid making magpie fail.

The new snoopy library uses Curl instead of the file handlers (fopen, fgets, etc). Basically all the functionality of snoopy is already in the curl extension, so I just had to write a wrapper for it. It should be a drop in replacement, but I’ve only tested it with magpie, so there might be some bugs still.

I’m happy again. If you are sad about snoopy and want to be happy as well, you can download the lib from this site. Should there be any bugs, please let me know.

For the record… If you are not using snoopy, don’t start now and just learn how to use curl.