Exemplo n.º 1
0
function xmlrpc_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
{
    if ($errno & (E_NOTICE | E_STRICT)) {
        return;
    }
    fault(-99, "PHP error {$errno}: {$errstr} at line {$errline} in {$errfile}");
}
Exemplo n.º 2
0
function fault()
{
    exit;
}
if (!isset($_GET["file"])) {
    fault();
}
$name = $_GET["file"];
if (substr($name, 0, 4) == "auth") {
    fault();
}
if (!preg_match("/^[a-zA-Z0-9-. _]*\$/i", $name)) {
    fault();
}
$file = $datafolder . $name;
if (!file_exists($file)) {
    if (!has_permissions()) {
        fault();
    }
    $file = $datafolder . "auth-" . $name;
    if (!file_exists($file)) {
        fault();
    }
}
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == filemtime($file)) {
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT', true, 304);
} else {
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT', true, 200);
    header('Content-Length: ' . filesize($file));
    echo file_get_contents($file);
}
Exemplo n.º 3
0
 }
 $nXmlReaderCount2 = $nIterateCount;
 $strDescription = '-- XML Reader in count read = "' . $nXmlReaderCount2 . '"' . PHP_EOL;
 $strLine = '';
 logLog(0, $strDescription, $strLine, 2);
 #2 check if well-formed by simply parsing through witout errors detected
 // Iterate
 $nIterateCount = 0;
 $nXmlReaderInErrorWellFormed = 0;
 try {
     while ($xmlReaderIn->read()) {
         // Count XML Read in
         print $nIterateCount++ . ', ';
         if (isset($php_errormsg)) {
             $nXmlReaderInErrorWellFormed++;
             fault(21, $php_errormsg);
         }
     }
 } catch (Exception $e) {
     $nXmlReaderInErrorWellFormed++;
     // Error: well-formed
     $strDescription = PHP_EOL . '## error: well-formed exception read no ' . $nIterateCount . ' ##' . PHP_EOL;
     $strLine = $e . PHP_EOL;
     logError(0, $strDescription, $strLine, 2);
 }
 print PHP_EOL;
 $nXmlReaderCount = $nIterateCount;
 $strDescription = '-- XML Reader in count read = "' . $nXmlReaderCount . '"' . PHP_EOL;
 $strLine = '';
 logLog(0, $strDescription, $strLine, 2);
 if (0 == $nXmlReaderInErrorWellFormed) {
Exemplo n.º 4
0
<?php

require_once 'ServiceListPrinter.php';
$soapClasses = array('CVHandler');
$slp = new ServiceListPrinter($soapClasses, "http://www.uis.no/cp/");
if ($slp->isNonSoapRequest()) {
    //echo "<pre>";var_dump($slp); echo "</pre>";
    $slp->show();
} else {
    try {
        $soapClass = $slp->getRequestClass();
        $soapImpl = $soapClass . 'Impl';
        include_once $soapImpl . '.php';
        $server = new SoapServer(null, array('uri' => "http://www.uis.no/cp/{$soapClass}", 'style' => SOAP_DOCUMENT, 'use' => SOAP_LITERAL));
        $server->setClass($soapClass);
        $server->handle();
    } catch (Exception $ex) {
        $slp - fault($ex);
    }
}
Exemplo n.º 5
0
<?php

$xmlUrl = "/api/v1/kmsg/stub";
$path = getCurrentUri();
if ($path == $xmlUrl) {
    return doKmsg();
} else {
    return fault("10001", "Invalid Endpoint");
}
function get_request_json_body()
{
    $input = file_get_contents("php://input");
    $input = json_decode($input, TRUE);
    return $input;
}
function get_request_xml_body()
{
    $input = file_get_contents("php://input");
    //$xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA);
    //$json = json_encode($xml);
    //$array = json_decode($json,TRUE);
    $xml = simplexml_load_string($input, null, LIBXML_NOCDATA);
    $json = json_encode($xml);
    $array = json_decode($json, TRUE);
    Header('Content-type: text/xml');
    return $array;
}
function fault($code, $msg)
{
    Header('Content-type: text/xml');
    //header("HTTP/1.1 200 OK");