Getting success response for Posting XML Data from PHP & curl
I have done the following code for the solution: <?php $url = "http://posttestserver.com/post.php"; // test post server $file="file.xml"; if (file_exists($file)) { // check file existance $headers = array( 'Content-Type: text/xml', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: en-US,en;q=0.5', 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0', 'Pragma: no-cache', 'Connect: close' ); $xml = file_get_contents($file); $stream_options = array( 'http' => array( 'method' => 'POST', 'header' => implode("\r\n", $headers), 'content' => trim($xml) ), ); echo "Context:".$context = stream_context_create($stream_options); // sending options echo "Response:".$response = file_get_contents($ur