<?php
$x_1 = new DOMDocument(); 
@$ret = $x_1->loadXML($HTTP_RAW_POST_DATA); 
if ($ret != TRUE) { 
header("HTTP/1.1 501 METHOD NOT IMPLEMENTED"); 
die; 
} 
$session = kerio("upnp::UpnpPhp"); 
$actions = $x_1->getElementsByTagName("Body"); 
$ind = 0; 
for ($i = 0; $i < $actions->length; $i++) { 
$action = $actions->item($i)->childNodes; 
for ($j = 0; $j < $action->length; $j++) { 
if ($action->item($j)->localName != "") { 
$param = $action->item($j)->childNodes; 
for ($k = 0; $k < $param->length; $k++) { 
if ($param->item($k)->localName != "") { 
$params[$ind]["name"] = $param->item($k)->localName; 
$params[$ind++]["value"] = $param->item($k)->textContent; 
} 
} 
$params[$ind]["name"] = "requestip"; 
$params[$ind]["value"] = $ip=$_SERVER['REMOTE_ADDR']; 
$outText=""; 
$header=""; 
$session->invokeAction($outText, $header, $action->item($j)->localName, $action->item($j)->namespaceURI, $params); 
header($header); 
$session->getServerHeader($header); 
header($header); 
header("CONTENT-TYPE: text/xml"); 
header("EXT:  -"); 
echo $outText; 
die; 
} 
} 
} 
header("HTTP/1.1 501 METHOD NOT IMPLEMENTED"); 
?>
