I'm pleased with myself. For a long time I've been wanting to get our library of books uploaded onto www.librarything.com, partly because it looks like a good 3rd party service offering that is going to do a better job than I am, and partly because it can show your books as collections of covers.

Media_httpwwwlibraryt_qggsi

The downside is that they don't have an API (programmatic interface) to add lots of books that I can use. They do have an import form where you can add multiple ISBNs in one go, but I haven't yet got the ISBNs for quite a lot of our books, and for some that I do have the ISBNs don't turn up in Amazon or their other sources of info.So I decided to write some PHP to poke the existing "advanced manual add" form with the contents of my book list, held in XML.Last night I got the POST operation working, after much more effort than I was expecting. Turns out the documentation for the various PHP libraries that deal with HTTP POST operations aren't as good as I'd like - particularly the PEAR one. In the end I went with cURL, which then took an age to install properly as you have to do odd things with libssl32.dll and libeay32.dll and the windows/system32 directory. Grr. Turns out I needed to have cookie authentication turned on, but otherwise it was fairly straightforward once I figured out the http_build_query function.Anyway, I'm writing the rest of the code today, so its not yet finished, but the results should be available at our profile - or the view of the books more directly at our catalog (sic).

Posted
AuthorJonathan Clark
CategoriesUncategorized