Most of this code is like the curlXml function... Do we actually need 2 functions that are pretty much the same? (actually, I'm not able to spot the difference :)