Grazie per la risposta.. sto imparando ora ad usare questa funzionalità..
Il problema è che quando invio il file XML ho un target che riceve il file XML attraverso uno specifico host.
Quando devo rispondere al file che mi inviano, come rispondo se l'host può essere uno qualunque?
O interpreto male io il funzionamento?
IL FILE LO INVIO COSI':
Codice PHP:
<?php /*** SCRIPT xml_post.php invia la request xml ***/
$host="localhost" ;
$target="http://localhost/xmlparse/xml_receive.php" ;
$port=80 ;
$timeout=60;
$protocol="HTTP/1.0" ;
$br="\r\n" ;
$xml_body=file_get_contents('example.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 ($sk, 2048);
}
}
fclose($sk) ;
echo($dati) ;
?>
C'è un modo migliore per farlo?