Ok, my bad. My function is returning the HTTP headers with the content, and that was making the XML parser to give an error. You have to return to the function I gave you and change a parameter inside it.
PHP Code:
curl_setopt($ch, CURLOPT_HEADER, true);
must become
PHP Code:
curl_setopt($ch, CURLOPT_HEADER, false);
This way it will work.