public function writeOutput()
 {
     if ($this->isFault()) {
         XMLRPC_error($this->faultCode, $this->faultString);
     } elseif ($this->returnValue == null) {
         // TODO: Can we return nothing throuh xmlrpc?
         // TODO: Why is XMLRPC_prepare going nuts with an empty string passed?
         XMLRPC_response(XMLRPC_prepare("void"));
     } else {
         $type = $this->returnValue->getType();
         if ($type == Types::DATE) {
             $convertedValue = XMLRPC_convert_timestamp_to_iso8601($this->returnValue->getValue());
         } else {
             $convertedValue = $this->returnValue->getValue();
         }
         XMLRPC_response(XMLRPC_prepare($convertedValue));
     }
 }
function mt_publishPost($params)
{
    global $loq;
    if ($loq->userauth($params[1], $params[2])) {
        // password accepted
        ob_start();
        XMLRPC_response(XMLRPC_prepare(true), WEBLOG_XMLPRPC_USERAGENT);
    } else {
        XMLRPC_error("301", "The username and password you entered was not accepted. Please try again.", WEBLOG_XMLRPC_USERAGENT);
    }
}
<?php

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
// XML-PRC сервер
require 'xmlrpc.php';
// Декларация методов
$xmlrpc_methods = array('simpleServer.sayHello' => 'sayHello');
// Обработка запроса
$rawPost = file_get_contents('php://input');
$xmlrpc_request = XMLRPC_parse($rawPost);
//$xmlrpc_request = XMLRPC_parse($HTTP_RAW_POST_DATA);
$methodName = XMLRPC_getMethodName($xmlrpc_request);
$params = XMLRPC_getParams($xmlrpc_request);
if (isset($xmlrpc_methods[$methodName])) {
    // Вызов метода
    $xmlrpc_methods[$methodName]($params);
} else {
    // Ошибка: Нет такого метода
    XMLRPC_error('2', "Метод , '{$methodName}' не найден.", WEBLOG_XMLRPC_USERAGENT);
}
// ----------------------- Методы -------------------------
function sayHello($params)
{
    $result = 'Привет, ' . $params[0] . '!';
    XMLRPC_response(XMLRPC_prepare($result), WEBLOG_XMLRPC_USERAGENT);
}
function XMLRPC_method_not_found($methodName)
{
    XMLRPC_error("2", "The method you requested, " . $methodName . ", was not found.", KD_XMLRPC_USERAGENT);
}
Example #5
0
function XMLRPC_method_not_found($methodName)
{
    XMLRPC_error("2", "The method you requested, '{$methodName}', was not found.", WEBLOG_XMLRPC_USERAGENT);
}