Cool. I also did this using curl at first, before switching to php for more flexibility. It's not as neatly concise as yours, but I think its pretty similar: https://gist.github.com/lyoshenka/6257440
I setup some code over at http://dhcp.io/ which presents an API for updating DynamicDNS via Amazon's route53 infrastructure.
I disabled new registrations due to abuse, but the code is open and I have about 1000 registered users. (5% of whom said they'd pay. 0% of whom did so when I made it an option. Gave up on charging at that point. Also disabled the registrations about a day later!)
I'm also using Cloudflare for DDNS, but I'm using my router's support for updating DDNS: I'm hosting a basic Sinatra app on Heroku that the router can ping. The app does a (very basic) auth check, extracts the public IP, and updates Cloudflare.