Mi scuso per il continuo invio di messaggi. Ma non riesco a venire a capo del problema.

Invio il mio codice di modo che la situazione sia un po' più chiara:

FILE CHE USO PER FARE IL POST:

Codice PHP:
<?php
/***
SCRIPT xml_post.php
invia la request xml
***/
$host="localhost" ;

$target="http://localhost/xmlparse/WriteUsers.php" ;
$port=80 ;
$timeout=60;
$protocol="HTTP/1.0" ;
$br="\r\n" ;

$xml_body=file_get_contents('example_users.xml');

$sk=fsockopen($host,$port,$errnum,$errstr,$timeout) ;

if(!
is_resource($sk))
{
exit(
"Connessione fallita: ".$errnum." ".$errstr) ;
}

else
{
$headers="POST ".$target." ".$protocol.$br ;
$headers.="Host: ".$host.$br ;
$headers.="Content-Type: text/xml".$br ;
$headers.="Content-Length: ".strlen($xml_body).$br.$br ;

fputs($sk$headers.$xml_body) ;
$dati="" ;

while (!
feof($sk)) 
{
$dati.= fgets ($sk2048);
}
}

fclose($sk) ;

$fileOutput "output.xml";
$XMLFile fopen($fileOutput"w") or die("can't open file");    
fwrite($XMLFile$dati); 
fclose($XMLFile);

header("Content-Type: text/xml"true);
header("Content-Disposition: attachment; filename=".basename($fileOutput)."");
header("Content-Transfer-Encoding:_ binary");
header("Content-Length: ".filesize($fileOutput)."");
readfile($fileOutput);
?>
FILE TARGET CHE PARSIFICA L'XML INVIATO:
Codice PHP:
<?php

// .. funzioni per parsificare i dati 

$strOutput "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
$strOutput .= "<root>";
$strOutput .= "<RequestID>".$x->RequestID."</RequestID>";
$strOutput .= "<ClientID>".$x->ClientID."</ClientID>";
$strOutput .= "<RequestedMethod>".$x->Method."</RequestedMethod>";
$ora=time();
$data=date('d M y - H:i:s'$ora);
$strOutput .= "<ResponseDate>".$data."</ResponseDate>";
$strOutput .= "<Response>".$check."</Response>";
$strOutput .= "<ResultSet>";
$strOutput .= "<Item>";

// .. qui gestisco le mie informazioni

$strOutput .= "<IdIn>".$ID."</IdIn>";
$strOutput .= "<IdOut>".$IDNew."</IdOut>";
$strOutput .= "<Codice>".$codice."</Codice>";
$strOutput .= "</Item>";
$strOutput .= "</ResultSet>";
$strOutput .= "</root>";

$fileOutput "output.xml";
$XMLFile fopen($fileOutput"w") or die("can't open file"); 
   
fwrite($XMLFile$strOutput); 
fclose($XMLFile); 

header("Content-Type: text/xml");
header("Content-Disposition: attachment; filename=".basename($fileOutput)."");
header("Content-Transfer-Encoding:_ binary");
header("Content-Length: ".filesize($fileOutput)."");
readfile($fileOutput);

mysql_free_result();
?>
Con questo codice quello che ottengo è il salvataggio di un file "ouput.xml", però non ha un formato XML, ma è un HTML con tutti i dati della pagina del browser e il mio xml.

Dove sbaglio?

Grazie