Saturday, March 4, 2006

Some PHP heroics
Blog

About a month or so ago I decided to add a recent comments feature to my blog. After searching the internet, the only solutions that I found basically were client-side only. When you published, you would invisibly publish all comments for all posts on the main page, and then some JavaScript would run on the client to geneate the recent comments list.

There are several drawback to this approach:
  • Only comments on posts currently on the main page would ever be shown.
  • The main page gets significantly larger as all comments are embedded in it.
So I decided to use MailBucket to turn the comment notification e-mails into an RSS feed, and then used PHP to transform that into the HTML to display (with caching to reduce the external hits). However, MailBucket seem to be garbling some of the comments with no good reason.

So this morning I have written a POP3 mail client using only PHP sockets (the PHP on the web server I use is out of date and doesn't include the POP library), and it all seems to be working correctly again.

Given I'm in management these days it's nice to do some real coding occasionally...

Update: Fixed the (hopefully only) bug. Apparently the received e-mails are only sometimes base64 encoded instead of all the time as I had assumed.

Trackbacks

TrackBack URL for this entry:


Post a comment