• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xmlrpc_server_call_method函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中xmlrpc_server_call_method函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpc_server_call_method函数的具体用法?PHP xmlrpc_server_call_method怎么用?PHP xmlrpc_server_call_method使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了xmlrpc_server_call_method函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute($request = null)
 {
     if ($request) {
         $this->_request = $request;
     }
     $this->_response = xmlrpc_server_call_method($this->_server, $this->_request, null, array('encoding' => $this->getOption('encoding')));
 }
开发者ID:jankal,项目名称:mvc,代码行数:7,代码来源:Server.php


示例2: process

 /**
  * Processes a request and sends a XML-RPC response.
  */
 public function process()
 {
     $options = ['output_type' => 'xml', 'verbosity' => 'pretty', 'escaping' => ['markup'], 'version' => 'xmlrpc', 'encoding' => 'utf-8'];
     $response = xmlrpc_server_call_method($this->server, file_get_contents('php://input'), null, $options);
     header('Content-Type: text/xml; charset="utf-8"');
     echo $response;
 }
开发者ID:jyxo,项目名称:php,代码行数:10,代码来源:Server.php


示例3: handlePost

 function handlePost()
 {
     $server = xmlrpc_server_create();
     xmlrpc_server_register_method($server, 'pingback.ping', array($this, 'ping'));
     echo xmlrpc_server_call_method($server, file_get_contents('php://input'), null, array('encoding' => 'utf-8'));
     xmlrpc_server_destroy($server);
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:8,代码来源:pingback.php


示例4: process

 /**
  * Processes an incoming request, executes it and builds a response.
  *
  * @since 5.1
  * @param ModuleServerRequest $request Incoming request.
  * @param ModuleServerResponse $response Outcoming response.
  * @return void
  */
 public function process(ModuleServerRequest $request, ModuleServerResponse $response)
 {
     $command = explode(' ', $request->getCommand());
     $module_location = $command[1];
     if (!strlen($module_location)) {
         $response->sendWarning(ModuleServerResponse::SC_NOT_FOUND, 'Module location not defined.', ModuleServerRsponse::ERROR_CLASSNAME_MISSING);
         return;
     }
     try {
         $locator = new ModuleLocator('module://' . $request->getHeader('User') . ':' . $request->getHeader('Password') . '@/' . $module_location);
         $sessionId = $request->getHeader('Session');
         if ($sessionId) {
             $this->module = ModuleFactory::getSessionModule($locator, $sessionId);
         } else {
             $this->module = ModuleFactory::getModule($locator);
         }
     } catch (ModuleException $e) {
         $response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, $e->__toString());
         return;
     } catch (\Exception $e) {
         $response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, $e->__toString());
         return;
     }
     if (!($xmlrpc_server = xmlrpc_server_create())) {
         $response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, 'Internal error: Could not create an XML-RPC server.', ModuleServerResponse::ERROR_XMLRPC_ERROR);
         return;
     }
     $theClass = new \ReflectionObject($this->module);
     $methods = $theClass->getMethods();
     foreach ($methods as $method) {
         // Ignore private methods
         $theMethod = new \ReflectionMethod($theClass->getName(), $method->getName());
         if (!$theMethod->isPublic()) {
             continue;
         }
         // Expose only methods beginning with "module" prefix
         if (!(substr($method->getName(), 0, 6) == 'module')) {
             continue;
         }
         xmlrpc_server_register_method($xmlrpc_server, strtolower($method->getName()), array($this, 'xmlrpcGateway'));
     }
     xmlrpc_server_register_introspection_callback($xmlrpc_server, array($this, 'introspectionGateway'));
     try {
         $buffer = xmlrpc_server_call_method($xmlrpc_server, $request->getPayload(), '', array('output_type' => 'xml'));
         $response->addHeader('Module/1.0 ' . ModuleServerResponse::SC_OK);
         $response->setBuffer($buffer);
     } catch (\Exception $e) {
         $response->addHeader('Module/1.0 ' . ModuleServerResponse::SC_INTERNAL_ERROR);
         $response->setBuffer($buffer);
     }
     xmlrpc_server_destroy($xmlrpc_server);
     $context = new ModuleContext($module_location);
     $session = new \Innomatic\Module\Session\ModuleSession($context, $sessionId);
     $session->save($this->module);
     $response->addHeader('Session: ' . $session->getId());
 }
开发者ID:kchizi,项目名称:innomatic-legacy,代码行数:64,代码来源:ModuleServerXmlRpcProcessor.php


示例5: __construct

 function __construct($payload, $payload_signed, $payload_encrypted)
 {
     $this->payload = $payload;
     // xmlrpc_decode_request is defined such that the '$method' string is
     // passed in by reference.
     $this->params = xmlrpc_decode_request($this->payload, $this->method, 'UTF-8');
     // The method name is not allowed to have a dot, except for a single dot
     // which preceeds the php extension. It can have slashes but it cannot
     // begin with a slash. We specifically don't want .. to be possible.
     if (0 == preg_match("@^[A-Za-z0-9]+/[A-Za-z0-9/_-]+(\\.php/)?[A-Za-z0-9_-]+\$@", $this->method)) {
         throw new XmlrpcServerException('The function does not exist', 6010);
     }
     if ($payload_signed && $payload_encrypted || $this->method == 'system/keyswap') {
         // The remote server's credentials checked out.
         // You might want to enable some methods for unsigned/unencrypted
         // transport
     } else {
         // For now, we throw an exception
         throw new XmlrpcServerException('The signature on your message was not valid', 6005);
     }
     // The system methods are treated differently.
     if (array_key_exists($this->method, $this->system_methods)) {
         $xmlrpcserver = xmlrpc_server_create();
         xmlrpc_server_register_method($xmlrpcserver, $this->method, array(&$this, $this->system_methods[$this->method]));
     } else {
         // Security: I'm thinking that we should not return separate errors for
         //           the file not existing, the file not being readable, etc. as
         //           it might provide an opportunity for outsiders to scan the
         //           server for random files. So just a single message/code for
         //           all failures here kthxbye.
         if (strpos($this->method, '/') !== false) {
             $this->callstack = explode('/', $this->method);
         } else {
             throw new XmlrpcServerException('The function does not exist', 6011);
         }
         // Read custom xmlrpc functions from local
         if (function_exists('local_xmlrpc_services')) {
             foreach (local_xmlrpc_services() as $name => $localservices) {
                 $this->services[$name] = array_merge($this->services[$name], $localservices);
             }
         }
         foreach ($this->services as $container) {
             if (array_key_exists($this->method, $container)) {
                 $xmlrpcserver = xmlrpc_server_create();
                 $bool = xmlrpc_server_register_method($xmlrpcserver, $this->method, 'api_dummy_method');
                 $this->response = xmlrpc_server_call_method($xmlrpcserver, $payload, $container[$this->method], array("encoding" => "utf-8"));
                 $bool = xmlrpc_server_destroy($xmlrpcserver);
                 return $this->response;
             }
         }
         throw new XmlrpcServerException('No such method: ' . $this->method);
     }
     $temp = '';
     $this->response = xmlrpc_server_call_method($xmlrpcserver, $payload, $temp, array("encoding" => "utf-8"));
     return $this->response;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:56,代码来源:dispatcher.php


示例6: execute

 /**
  * @param string $xml
  * @return string
  */
 public function execute($xml = NULL)
 {
     if (is_null($xml)) {
         $xml = file_get_contents('php://input');
     }
     try {
         return xmlrpc_server_call_method($this->getHandle(), $xml, array(), Xmlrpc::getDefaultOptions());
     } catch (Exception $exception) {
         return Xmlrpc::encodeResponse(array('faultCode' => $exception->getCode(), 'faultString' => $exception->getMessage()));
     }
 }
开发者ID:blar,项目名称:xmlrpc,代码行数:15,代码来源:XmlrpcServer.php


示例7: callMethod

 /**
  * Handles the RPC request
  * @param string $requestPayload
  * @return string XML RPC response
  */
 public function callMethod($requestPayload)
 {
     try {
         return xmlrpc_server_call_method($this->_xmlrpcServer, $requestPayload, null);
     } catch (TRpcException $e) {
         return $this->createErrorResponse($e);
     } catch (THttpException $e) {
         throw $e;
     } catch (\Exception $e) {
         return $this->createErrorResponse(new TRpcException('An internal error occured'));
     }
 }
开发者ID:pradosoft,项目名称:prado,代码行数:17,代码来源:TXmlRpcProtocol.php


示例8: serializationAction

/**
 * This won't ever be called unless there is an error
 */
function serializationAction(&$body)
{
    $request_xml = $body->getValue();
    $toSerialize = $body->getResults();
    $lambdaFunc = 'return $userData;';
    $func = create_function('$a,$b,$userData', $lambdaFunc);
    $xmlrpc_server = xmlrpc_server_create();
    $request_xml = $body->getValue();
    xmlrpc_server_register_method($xmlrpc_server, $body->packageClassMethodName, $func);
    $response = xmlrpc_server_call_method($xmlrpc_server, $request_xml, $toSerialize);
    $body->setResults($response);
}
开发者ID:FalconGT,项目名称:DrEvony,代码行数:15,代码来源:Actions.php


示例9: respond

 public function respond($xml = null)
 {
     if (!$xml) {
         $xml = file_get_contents("php://input");
     }
     try {
         $output = xmlrpc_server_call_method($this->server, $xml, null);
     } catch (RPCException $e) {
         $output = array('faultString' => $e->getMessage(), 'faultCode' => $e->getCode());
         $output = xmlrpc_encode_request(null, $output);
     }
     echo $output;
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:13,代码来源:server.php


示例10: processRequest

 /**
  * Request processor
  * @param object $handler
  * @param array|bool $methodsList If omitted, handler should contain getMethods() method
  * @return string
  */
 public function processRequest($handler, $methodsList = false)
 {
     $server = xmlrpc_server_create();
     if (!$methodsList) {
         $methodsList = $handler->getMethods();
     }
     foreach ($methodsList as $method) {
         xmlrpc_server_register_method($server, $method, [$handler, $method]);
     }
     $request = (isset($HTTP_RAW_POST_DATA) and $HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents('php://input');
     $response = xmlrpc_server_call_method($server, $request, null);
     xmlrpc_server_destroy($server);
     return $response;
 }
开发者ID:difra-org,项目名称:difra,代码行数:20,代码来源:XMLRPC.php


示例11: _handle

 /**
  * handle request
  * @param string $pData optional, data from standard input will be used as
  * default
  * @param boolean $displayReponse
  * @return mixed
  */
 public function _handle($pData = null, $displayReponse = true)
 {
     if (\is_null($pData)) {
         $pData = \Savant\Protocol\CHttp::getPostData();
     }
     if (empty($pData)) {
         throw new EXMLRPCServer("invalid xml rpc call without data");
     }
     \Savant\CBootstrap::setContentType(\Savant\CBootstrap::CONTENT_TYPE_XMLRPC);
     $response = \xmlrpc_server_call_method($this->server, $pData, '');
     if ($displayReponse) {
         print $response;
     }
     return $response;
 }
开发者ID:Broncko,项目名称:Savant,代码行数:22,代码来源:AXMLRPCServer.php


示例12: handleClient

 protected function handleClient($client)
 {
     // Read request from client
     try {
         $client->readRequest();
     } catch (A2o_AppSrv_Client_Exception $e) {
         $this->_log("Error reading client request: " . $e->getMessage());
         $this->closeConnection();
         return;
     }
     // Log
     $this->_log("Client requested call to RPC method: {$client->method}");
     // Construct response
     $response = xmlrpc_server_call_method($this->XmlRpcServer, $client->requestRawXml, NULL);
     // Send the reponse back to the client
     $client->writeResponse($response);
     // Close the client connection
     $this->closeConnection();
 }
开发者ID:bostjanskufca,项目名称:PHP-application-server,代码行数:19,代码来源:A2o_AppSrv_Worker_DemoXmlRpc.php


示例13: setUpXmlRpcTypes

    private function setUpXmlRpcTypes($xmlrpc_das)
    {
        $typeList = <<<END
<introspection>
    <typeList>

        <typeDescription name='SimpleType' basetype='struct' desc='Simple type'>
    
            <value type='int' name='intValue'></value>
            <value type='double' name='doubleValue'></value>
            <value type='string' name='strValue'></value>

        </typeDescription>

        <typeDescription name='ComplexType' basetype='struct' desc='Complex type'>

            <value type='SimpleType []' name='objArrValue'></value>
            <value type='int []' name='intArrValue'></value>
            <value type='int' name='intValue'></value>
            <value type='double' name='doubleValue'></value>
            <value type='string' name='strValue'></value>
            <value type='SimpleType' name='objValue'></value>

        </typeDescription>
    </typeList>
</introspection>
END;
        $call = <<<END
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
    <methodName>system.describeMethods</methodName>
    <params/>
</methodCall>
END;
        $xmlrpc_server = xmlrpc_server_create();
        $descArray = xmlrpc_parse_method_descriptions($typeList);
        xmlrpc_server_add_introspection_data($xmlrpc_server, $descArray);
        $response = xmlrpc_server_call_method($xmlrpc_server, $call, null);
        xmlrpc_server_destroy($xmlrpc_server);
        $methodDesc = xmlrpc_decode_request($response, $method);
        $this->xmlrpc_das->addTypesXmlRpc($methodDesc["typeList"]);
    }
开发者ID:psagi,项目名称:sdo,代码行数:42,代码来源:XmlRpcTest.php


示例14: generate

    /**
     * Generate
     *
     * @param string $service_description Service Description
     *
     * @return null
     */
    public function generate($service_description)
    {
        SCA::$logger->log("Entering");
        try {
            $xmlrpc_server = xmlrpc_server_create();
            $aliases = array();
            $this->addIntrospectionData($xmlrpc_server, $service_description, $aliases);
            $describeMethods = <<<END
<?xml version="1.0" ?>
<methodCall>
<methodName>system.describeMethods</methodName>
<params/>
</methodCall>
END;
            $desc = xmlrpc_server_call_method($xmlrpc_server, $describeMethods, null);
            xmlrpc_server_destroy($xmlrpc_server);
            header('Content-type: text/xml');
            echo $desc;
        } catch (Exception $se) {
            echo $se->exceptionString() . "\n";
        }
    }
开发者ID:psagi,项目名称:sdo,代码行数:29,代码来源:ServiceDescriptionGenerator.php


示例15: processRequest

function processRequest(&$request_xml)
{
    // define XML-RPC server
    $server = xmlrpc_server_create();
    // log for debuggin
    $fp = fopen("/var/tmp/ws_request.log", "a");
    fwrite($fp, date("H:i") . "\n");
    fwrite($fp, $request_xml);
    fwrite($fp, "\n\n");
    fclose($fp);
    // register methods
    xmlrpc_server_register_method($server, "getQueueValues", "rpc_get_queue_values");
    xmlrpc_server_register_method($server, "pushValue", "rpc_push_value");
    xmlrpc_server_register_method($server, "getStateData", "rpc_get_state_data");
    xmlrpc_server_register_method($server, "setStateData", "rpc_set_state_data");
    xmlrpc_server_register_method($server, "helloWorld", "rpc_hello_world");
    xmlrpc_server_register_method($server, "noop", "rpc_hello_world");
    // call the method
    $response =& xmlrpc_server_call_method($server, $request_xml, '');
    // send back the respond
    print $response;
    // release resources
    xmlrpc_server_destroy($server);
}
开发者ID:andrewhuang,项目名称:webscheme,代码行数:24,代码来源:xmlrpc.php


示例16: parseRequest

 function parseRequest($data = '')
 {
     global $HTTP_RAW_POST_DATA;
     if ($data == '') {
         $data = $HTTP_RAW_POST_DATA;
     }
     //			return $this->echoInput($data);
     /* Decode to extract methodName */
     $params = xmlrpc_decode_request($data, &$methName);
     $this->last_method = $methName;
     $syscall = 0;
     /* Setup dispatch map based on the function, if this is a system call */
     if (ereg('^system\\.', $methName)) {
         foreach ($GLOBALS['_xmlrpcs_dmap'] as $meth => $dat) {
             $this->add_to_map($meth, $dat['function'], $dat['signature'], $dat['docstring']);
         }
         $sysCall = 1;
         $dmap = $this->dmap;
     } elseif (ereg('^examples\\.', $methName) || ereg('^validator1\\.', $methName) || ereg('^interopEchoTests\\.', $methName)) {
         $dmap = $this->dmap;
         $sysCall = 1;
     }
     /* verify dispatch map, or try to fix it for non-trivial system calls */
     if (!isset($this->dmap[$methName]['function'])) {
         if ($sysCall) {
             /* Bad or non-existent system call, return error */
             $r = CreateObject('phpgwapi.xmlrpcresp', '', $GLOBALS['xmlrpcerr']['unknown_method'], $GLOBALS['xmlrpcstr']['unknown_method'] . ': ' . $methName);
             return $r;
         }
         if ($this->authed) {
             $method = $methName;
             list($app, $class, $method) = explode('.', $methName);
             switch ($app) {
                 case 'server':
                 case 'phpgwapi':
                     /* Server role functions only - api access */
                     if ($GLOBALS['phpgw']->acl->get_role() >= PHPGW_ACL_SERVER) {
                         $dmap = ExecMethod(sprintf('%s.%s.%s', 'phpgwapi', $class, 'list_methods'), 'xmlrpc');
                     }
                     break;
                 case 'service':
                     /* Service functions, user-level */
                     $t = 'phpgwapi.' . $class . '.exec';
                     $dmap = ExecMethod($t, array($service, 'list_methods', 'xmlrpc'));
                     break;
                 default:
                     /* User-level application access */
                     if ($GLOBALS['phpgw']->acl->check('run', PHPGW_ACL_READ, $app)) {
                         $dmap = ExecMethod(sprintf('', $app, $class, 'list_methods'), 'xmlrpc');
                     } else {
                         $r = CreateObject('phpgwapi.xmlrpcresp', '', $GLOBALS['xmlrpcerr']['no_access'], $GLOBALS['xmlrpcstr']['no_access']);
                         return $r;
                     }
             }
         }
     }
     /* add the functions from preset $dmap OR list_methods() to the server map */
     foreach ($dmap as $meth => $dat) {
         $this->add_to_map($meth, $dat['function'], $dat['signature'], $dat['docstring']);
     }
     /* _debug_array($this->dmap);exit; */
     /* Now make the call */
     if (isset($dmap[$methName]['function'])) {
         // dispatch if exists
         if (isset($dmap[$methName]['signature'])) {
             $sr = $this->verifySignature($m, $dmap[$methName]['signature']);
         }
         if (!isset($dmap[$methName]['signature']) || $sr[0]) {
             // if no signature or correct signature
             $r = xmlrpc_server_call_method($this->server, $data, $params);
         } else {
             $r = CreateObject('phpgwapi.xmlrpcresp', '', $GLOBALS['xmlrpcerr']['incorrect_params'], $GLOBALS['xmlrpcstr']['incorrect_params'] . ': ' . $sr[1]);
         }
     } else {
         // else prepare error response
         if (!$this->authed) {
             //					$r = False;
             // send 401 header to force authorization
             $r = CreateObject('phpgwapi.xmlrpcresp', CreateObject('phpgwapi.xmlrpcval', 'UNAUTHORIZED', 'string'));
         } else {
             $r = CreateObject('phpgwapi.xmlrpcresp', '', $GLOBALS['xmlrpcerr']['unknown_method'], $GLOBALS['xmlrpcstr']['unknown_method'] . ': ' . $methName);
         }
     }
     xmlrpc_server_destroy($xmlrpc_server);
     return $r;
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:86,代码来源:class.xmlrpc_server_epi.inc.php


示例17: call

 /**
  * Calls a method by its rpc name. 
  * @param string $method The rpc name of the method
  * @param array $args The arguments to this method
  * @return mixed
  * @throws Ripcord_InvalidArgumentException (ripcord::cannotRecurse) when passed a recursive multiCall
  * @throws Ripcord_BadMethodCallException (ripcord::methodNotFound) when the requested method isn't available.
  */
 public function call($method, $args = null)
 {
     if (isset($this->methods[$method])) {
         $call = $this->methods[$method]['call'];
         return call_user_func_array($call, $args);
     } else {
         if (substr($method, 0, 7) == 'system.') {
             if ($method == 'system.multiCall') {
                 throw new Ripcord_InvalidArgumentException('Cannot recurse system.multiCall', ripcord::cannotRecurse);
             }
             // system methods are handled internally by the xmlrpc server, so we've got to create a makebelieve request,
             // there is no other way because of a badly designed API
             $req = xmlrpc_encode_request($method, $args, $this->outputOptions);
             $result = xmlrpc_server_call_method($this->xmlrpc, $req, null, $this->outputOptions);
             return xmlrpc_decode($result);
         } else {
             throw new Ripcord_BadMethodCallException('Method ' . $method . ' not found.', ripcord::methodNotFound);
         }
     }
 }
开发者ID:funbaker,项目名称:ripcord,代码行数:28,代码来源:ripcord_server.php


示例18: array

    if ($HTTP_POST_VARS[verbosity]) {
        $display[verbosity] = $HTTP_POST_VARS[verbosity];
    }
    if ($HTTP_POST_VARS[escaping]) {
        $display[escaping] = $HTTP_POST_VARS[escaping];
    } else {
        $display[escaping] = array("non-ascii", "markup");
    }
    if ($HTTP_POST_VARS[version]) {
        $display[version] = $HTTP_POST_VARS[version];
    }
    if ($HTTP_POST_VARS[encoding]) {
        $display[encoding] = $HTTP_POST_VARS[encoding];
    }
    if ($HTTP_POST_VARS[output_type]) {
        $display[output_type] = $HTTP_POST_VARS[output_type];
    }
    /* handle the request */
    $response = xmlrpc_server_call_method($server, $request_xml, $response, $display);
    if ($HTTP_POST_VARS[disp] === "html") {
        if ($HTTP_POST_VARS[output_type] === "php") {
            echo "<xmp>\n";
            var_dump($response);
            echo "\n</xmp>\n";
        } else {
            echo "<xmp>\n{$response}\n</xmp>\n";
        }
    } else {
        echo "{$response}";
    }
}
开发者ID:hugcoday,项目名称:wiki,代码行数:31,代码来源:validate.php


示例19: handleRequest

 /**
  * Méthoode qui gère les requêtes effectuées par les clients xmlrpc.
  *
  * @access public
  * @return void
  */
 public function handleRequest()
 {
     // récupère le xml envoyé par le client
     $params = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents('php://input');
     // output_options
     // http://xmlrpc-epi.sourceforge.net/main.php?t=php_api#output_options
     $output_options = array('encoding' => $this->encoding, 'verbosity' => 'no_white_space');
     // sette la locale
     if (isset($_SESSION['locale'])) {
         I18N::setLocale($_SESSION['locale']);
     }
     // appelle la méthode
     $response = xmlrpc_server_call_method($this->_server, $params, null, $output_options);
     header('Content-Type: text/xml');
     header('Content-Length: ' . strlen($response));
     echo $response;
     // nettoyage
     xmlrpc_server_destroy($this->_server);
 }
开发者ID:arhe,项目名称:pwak,代码行数:25,代码来源:Server.php


示例20: get_stock

<?php

/* Наш склад */
$stock = ['a' => 100, 'b' => 200, 'c' => 300];
/* Основная функция */
function get_stock($method_name, $args, $extra)
{
    $code = $args[0];
    if (isset($GLOBALS['stock'][$code])) {
        return "На полке '{$code}' " . $GLOBALS['stock'][$code] . ' товаров';
    } else {
        return ['faultCode' => 1, 'faultString' => "Полка '{$code}' отсутствует!"];
    }
}
/* Создаем XML-RPC сервер и регистрируем функцию */
$server = xmlrpc_server_create();
xmlrpc_server_register_method($server, "getStock", "get_stock");
// Принимаем запрос
$request = file_get_contents("php://input");
/*Отдаем правильный заголовок*/
header('Content-Type: text/xml;charset=utf-8');
/* Отдаем результат */
print xmlrpc_server_call_method($server, $request, null);
开发者ID:Forneet,项目名称:spec,代码行数:23,代码来源:server.php



注:本文中的xmlrpc_server_call_method函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xmlrpc_server_create函数代码示例发布时间:2022-05-23
下一篇:
PHP xmlrpc_removepostdata函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap