Post a XML File using PHP without cURL

$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);

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.