If you need to create XML files in PHP, you can do it without having to create the tags yourself with strings. This code shows you how to use the new_child functions to create an XML file.
can you give us an example of exactly whta your trying to do? because 'posting an XML string to a url' is as simple as url.com?xmlstring=$data... so maybe I misunderstood?