I thought it might be useful to some people that are requiring shortlinking on their websites so this is just a simple class I created that you can use. It's fairly easy to read and example usage can be found at the bottom of the code where the class finishes. Hope it helps.