In reply to Ryan McCue.

Take a look at the WP_Automatic_Updater class in WordPress for the mechanics of how that works.