This here is an almost exact copy of curlxml ...
You could also add a parameter to curlxml.
By the way, XML/JSON ...  If you already have the parameters contenttype and accept, why is the function called curlXML ?
And why does curljson exist?

I would probably replace all these functions with just one single function 'that does it all'.
Later if you want to create 'convenience functions', calling that function that does it all, that's another thing,