MartijnL,
I strongly urge you to follow Shawn's suggestion to use the API as it will not transmit the password over the wire in clear text. Your approach would, leaving a large security hole.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.