CURL与XML发布数据问题

I am using CURL-PHP to post data to server. Options are set to curl through curl_setopt function. But somehow anonymous user enters "&" in his password. As data is collected in xml so as Xml's drawback it stops there and fires some XML Exception. If i used CDATA then it may not parse that password and ultimately authentication wil be failed. I used php encoding functions like htmlentities,html_entit_decode,utf8_encode,utf8_encode,urlencode nad urldecode. But the issue is same. Is there any method to send "&" through XML and posted that data thurh CURL. As per my knowledge, CURL itself internally parses.

Thanks,

First of all ensure that XML string contains &amp in password before posting

(<password>123&amp;</password> or <user password="123&amp;"></user> for 123&amp;

htmlentities() must be applied to $password, nor to $xml_data. Than ensure that it attached to curl request like curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);

Without any additional encodings. It should work! In other cases problem on POST handler side.