PHP Library For Convio Open API

If any of you out there use Convio for your non-profit’s on-line presence, ie website, donations, email campaigns, I’ve created a PHP library for connecting to their Open API.

Convio Logo

I say it’s a “Library”… it’s really just a single wrapper file that aids in connecting to, making call to, and handling responses from, the Convio Open APIs.

There’s no documentation to speak of, but the two files included in the zip archive are pretty solidly commented, so you will probably be able to get a lot from them. The two files included in the zip are the library file itself and an example of how to implement it.

If you end up using it, let me know what you think!

Download the PHP Library for Convio Open API

SXSW Interactive

Another year has passed. New lines have formed on my face, my stoop has become a little more pronounced, and another South by Southwest is upon us. Ah, South by Southwest, or SXSW as it’s more commonly known. Because, of course, how could a music and film festival possibly consider itself trendy unless one boils it down into a soulless, meaningless acronym. OMG SXSW is FAB like ACL.

So, once a year our fair little central Texas city is descended upon by cous-cous eating, cilantro seasoning, south Cali, Apple fan boys for three weeks of self-satisfying, self-appreciating, and self-nauseating fawning over music and film that’s too smart to be interesting. BTW, Chucks and horn-rimmed glasses aside, this entry has been, so far, largely self-loathing, as I am writing this very entry on a netbook running OSX and have just checked the time and weather on my iPhone. WTF ROFL AFK BRB OK. Oh and I’ve been listening to nothing but Silversun Pickups and M83, so I’m just about ready to watch MINE: Taken by Katrina.

Cynicism aside, SXSW brings a lot of interesting people and art to Austin and one of the interesting and less publicized aspects is “Interactive,” five days of technology related trade shows, keynotes, and seminars. I have been given the opportunity, by my great employer, sorry, MGE, to attend this year’s interactive event. Being that this is the first time I’ll be attending SXSW I’m excited to see what all the hub-bub is about and what sort of douchebaggery I’ll be faced with.

Editor’s Note: Firefox underlines all my misspellings. It underlined “netbook”, “iPhone”, but not “douchebaggery” … awesome.

JProQuiz: Javascript Quiz Software

A couple of weeks ago a friend asked me if I’d be interested doing a little contract work for the company he works for. The project was to come up with an on line quiz, mimicking that of FreeRice.com. Reasonably simple I thought, so I figured it might be good for a laugh and few pennies. The caveat being, if possible, for it to be entirely browser-side, as his company’s software did not support server-side code. Now that sounded interesting.

Being the impulsive code-monkey that I am, instead of waiting for the finalization of my contract to come through, I simply went ahead and coded the whole thing. Naturally, they decided to give this to someone internal and not hire me, so their loss is your gain. I didn’t have anything to do with this software after I’d written it, so I figured I would publish it here on my blog for the whole world to use.

The software itself is incredibly simple. Actually, I hesitate to call it software at all. It’s just one Javascript class file, some specifically name HTML elements and a single Javascript call to start the whole thing up. I like the Prototype framework, so I decided to use that to power JProQuiz, hence the “Pro” part. I also used the Scriptaculous builder so I wouldn’t have too much messy HTML in the class file. The entire class file (quiz.js) is less than 300 lines long and the majority of those are comments. (Can you tell I’m a little proud of it?)

The basic idea is a single class that acts as an engine and using a JSON configuration file, which contains all the quiz questions, options, and correct answers, drives the entire quiz experience for the user. Now, you’re probably wondering: “How do you keep the JSON config file obfuscated so that people can’t just look at the answers?” Err… well… you can’t. This quiz is entirely browser-side, so the data has to be available to the front end. The JSON file is sort of buried in the class file, so it’s definitely not immediately obvious where the questions are coming from. It would take someone who knew their way around Javascript to figure out what was going on. And if someone really wants to dig through your code and find your JSON file and read all the answers so they can get a 100% on your little web quiz, well, boogaloo for them. So, don’t use JProQuiz to power the new on line SATs, just use it for fun little quizzes.

You can download JProQuiz here.

And you can see a live example here.

If you use JProQuiz please let me know by commenting below. Or if you have any questions, suggestions, or bugs . . . bring ‘em on!

Last.FM PHP Image Screen Scraper

I’m pretty avid user of Last.FM. I’m not big on this social networking fad, even if I do work in the industry, but I’ve found Last.FM very useful, mainly for finding new music. I’m currently building a web-based media manger in PHP and wanted a way to automatically get images for the artists.

I originally used the discogs.com API and although it was pretty easy to use and reasonably comprehensive, I was really disappointed in the quality of the images, not to mention I was constantly getting back images of electronic and ambient artists who had names similar to the rock bands in my collection, rather than the rock band themselves. I’m sorry, but when make a call to get images for “Cream” I don’t expect to get back some 14-year-old kid with a turntable and a DAT machine; I want freaking Clapton, Bruce, and Baker.

So, discogs.com left me a bit cold. But I soon learned about Last.FM and was delighted when I discovered their API. The image quality at Last.FM is superb, so I knew I wouldn’t be disappointed there. I started researching their API and realized that they didn’t really give me any info I needed other than the images and I didn’t want to have to sign up for an API key if all I wanted to do was download pictures of bands. Also, they only appear to provide three sizes of images and for many bands they have a whole slew of images available: large, medium, small, smaller, square; I wanted them all, not just the three provided by their API.

So, in the end I decided not to sign up for a Last.FM API key and instead wrote a very simple little PHP screen scraper that would bring back all of the images I wanted. Last.FM actually aided me in my goal by embedding a JSON string with just exactly what I needed right onto the artist page. It worked very well, so I decided to stick with it.

You can download my simple screen scraper script here. The zip file includes the class file and an example file.

It’ an incredibly simple script. Just a basic class file with only one useable method. It’s written so it can be expanded, but as Last.FM’s API is under constant development, it probably won’t be. But if you just want a simple script to grab artist images from Last.FM, please download my script and let me know if you like it.