Well, I have identified the problem, but have no idea how to get around it.
The code is:
print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
and the problem is in the last part where we have "?>".
I guess the interpretor in php think that this is the end of the php code and not just something to write on the screen.
Can I get around it??? Somebody?