Here’s another variant on the same approach, setting a header for XML data and using file_get_contents() instead of fopen() (but the same fopen wrappers are used).

[geshi lang=php]
$context = stream_context_create(array(
‘http’ => array(
‘method’ => ‘POST’,
‘header’ => ‘Content-Type: application/xml’,
‘content’ => $xml
)
));

$result = file_get_contents($url, false, $context);
[/geshi]