The Lurker

Latest posts | Archive

posted by ajf on 2002-07-17 at 05:42 pm

I've taken a few steps towars updating the code that runs this page. Obviously new are the author links, which are almost completely useless, considering there's only one author. Behind the scenes, I've moved some stuff out of PHP code and into Python CGI scripts, which is one of the things I needed to do before I can write the web-based posting code.

Because my hosting provider doesn't seem to have the python module for Berkeley DB (though the library itself is available, and I can use it from PHP), I ended up finding an alternative interface to it called bsddb3. It includes a cheap-and-cheerful class for easily storing the kind of stuff I would otherwise have to pay extra for. It's not nearly as powerful as a real database, and there are bits and pieces I want to rewrite already after less than 24 hours of using it, but it is just so easy to use that I will be able to implement the Python side of posting (ie, actually getting a content item into the database) easily.

Unfortunately, I've found that getting the data from PHP (which is responsible at the moment for actually displaying the site) to the Python CGI script isn't going to be so easy. In PHP, you can open a HTTP URL just like reading a file off the local file system, but it only supports GET — you can't use the POST method to send data using the normal file-handling functions. Fortunately PHP also provides an interface to curl, which should be able to handle it in a sane way. For a while there I thought I'd have to write a HTTP request in PHP code, which although not difficult seemed like a lot of wasted effort. I'll keep using the file-like method for the GET operations, though, because the code is so simple.

Related topics: The Lurker

All timestamps are Melbourne time.