接收XML-PHP

接收XML-PHP,php,Php,我已经发送了send.php: <? if( $curl = curl_init() ) { curl_setopt($curl, CURLOPT_URL, 'http://www.example.com'); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); $out = curl_exec($curl); echo $out; curl_close($curl); } ?> 但是xml

我已经发送了send.php:

<?
 if( $curl = curl_init() ) {
    curl_setopt($curl, CURLOPT_URL, 'http://www.example.com');
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
    $out = curl_exec($curl);
    echo $out;
    curl_close($curl);
  }
?>
但是xmldoc不是XML。 我想发送XML($out)。
我该怎么做?

从您的问题中不清楚
$out
包含什么内容,使用PHP,您可以执行一些字符串操作,将值转换为XML字符串(如果值可以转换为字符串):

printf(“%s”,htmlspecialchars($out));

将您的
echo
行替换为该行,它可能已经工作了。否则,您需要更具体地回答您的问题。

如果您想将XML文档发布到URI,请查看此问题右侧的相关项目。你应该在那里找到你想要的东西。(同时,也许有必要澄清你的问题,因为目前关于细节的问题还很少!)我知道。很抱歉我的英语不是很好
 function makeRequestXML(url) {
            http_request = false;

            ...
            http_request.onreadystatechange = ContentsXML;
            http_request.open('GET', 'send.php', true);
            http_request.send(null);
        }
function ContentsXML() {
    alert(http_request.readyState);
    alert(http_request.status);
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                number_checkbox = 0;
                var xmldoc = http_request.responseXML;
 printf('<root>%s</root>', htmlspecialchars($out));