if (empty($port)) {
    $port = "80";
}
$contenttype = @$_REQUEST['contenttype'];
if (empty($contenttype)) {
    $contenttype = "text/xml";
}
$data = @$GLOBALS["HTTP_RAW_POST_DATA"];
// define content type
header("Content-type: " . $contenttype);
if (empty($data)) {
    $result = send_request();
} else {
    // post XML
    $posting = new HTTP_Client($host, $port, $data);
    $posting->set_path($path);
    $result = $posting->send_request();
}
// strip leading text from result and output result
$len = strlen($result);
$pos = strpos($result, "<");
if ($pos > 1) {
    $result = substr($result, $pos, $len);
}
//$result = str_replace("xlink:","",$result);
echo $result;
// define class with functions to open socket and post XML
// from http://www.phpbuilder.com/annotate/message.php3?id=1013274 by Richard Hundt
class HTTP_Client
{
    var $host;