Krizalidfx
New Member
I'm reading an XML data from a PHP input and i'm receving the number 1 instead of the XML data.the PHP code for reading the XML Data from PHP input:\[code\] $xmlStr=""; $file=fopen('php://input','r'); while ($line=fgets($file) !== false) { $xmlStr .= $line; } fclose($file);\[/code\]the PHP code for sending the XML:\[code\]public static function xmlPost($url,$xml) { $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, 1); // set url to post to curl_setopt($ch, CURLOPT_URL, $url); // set url to post to curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 40); // times out after 4s curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); // add POST fields curl_setopt($ch, CURLOPT_POST, 1); $result=curl_exec ($ch); return $result;}\[/code\]no matter what XML i'm sending, the receiving end is getting the number 1 insteadof the XML data. any ideas?any information regarding the issue would be greatly appreciated. updatethe following code works:\[code\]$xmlStr = file_get_contents('php://input');\[/code\]but why my code doesn't ?why my code returns 1 instead of the actual xml ?