Ciao a tutti,

ho un problema da porvi...sto testando le chiamate curl per inviare a ricevere xml, praticamente invio un piccolo xml e voglio che la mia pagina di response me lo ritorni modificato. Ho queste pagine:

codice:
/*------------- index.php ---------------*/

<?php
	require_once("function.php");
	
	$xml = new SimpleXMLElement("<say></say>");
	$xml->addChild("hello", "hello world!");
	
	echo "

".htmlentities($xml->asXML())."</p>";
	
	echo "

".htmlentities(getResponse($xml->asXML()))."</p>";
?>
codice:
/*------------- function.php ---------------*/

<?php
	function getResponse($xml){
		echo "

Entro nella funzione</p>";
		// ho due parametri che sono le variabili 'sistema e xml'	
	
		$params['sistema']=$_SERVER['SERVER_ADDR'];;
		$params['xml']=$xml;
		$errore="";
	
	
		$url="http://127.0.0.1/varie/curl_test/response.php";
		
		$ch=curl_init();
		curl_setopt($ch, CURLOPT_TIMEOUT, 30);
		curl_setopt($ch, CURLOPT_POST,1);
		curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
		curl_setopt($ch, CURLOPT_URL,$url);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  // this line makes it work under https
		ob_start();
	
		$ER_result=curl_exec($ch);
		
		echo "

ho preso il risultato della chiamata curl</p>";
		
		//Nella variabile $ER_result ho il valore di ritorno della procedura che sto chiamando
		//Verifica errore
		if (strpos($ER_result,"00")===false)
			$my_str="ERRORE";
		else
			$my_str="";
	
		if(curl_errno($ch))
			$error= curl_error($ch);
		ob_end_clean();
		curl_close($ch);
		
		echo "

ritorno il valore</p>";
		return $ER_result;
	}
?>
codice:
/*-------------- response.php -----------------*/

<?php
        $aXML = simplexml_load_string(stripslashes($_POST["xml"]));
	$newXML = new SimpleXMLElement($aXML);
	$newXML->addChild("answer", "Hi guys!");
	echo $newXML->asXML();
?>
praticamente mi entra correttamente nella funzione fa la sua richiesta curl ma c'è un problema nel parsing xml (sicuramente è una stupidata, ma sono ancora abbastanza alle prime armi)...la pagina di output è questa:
codice:
<?xml version="1.0"?> <say><hello>hello world!</hello></say>

Entro nella funzione

ritorno il valore


 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\Programmi\EasyPHP 3.0\www\varie\curl_test\response.php:12 Stack trace: #0 C:\Programmi\EasyPHP 3.0\www\varie\curl_test\response.php(12): SimpleXMLElement-&gt;__construct('') #1 {main} thrown in C:\Programmi\EasyPHP 3.0\www\varie\curl_test\response.php on line 12
come vedete crea correttamente l'xml e ritorna il valore della chiamata curl...se io in response faccio semplicemente echo $_POST["xml"] funziona correttamente. Qualcuno sa dove sta l'errore?? Grazie a tutti!