<?php $xml = file_get_contents('post_xml.xml'); $url = 'http://url.com'; $post_data = array( "xml" => $xml, ); $stream_options = array( 'http' => array( 'method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'content' => http_build_query($post_data), ), ); $context = stream_context_create($stream_options); $response = file_get_contents($url, null, $context);