Overview

Packages

  • Jyxo_Beholder
  • Jyxo_Charset
  • Jyxo_Color
  • Jyxo_Css
  • Jyxo_ErrorHandling
  • Jyxo_FirePhp
  • Jyxo_Gettext
    • Parser
  • Jyxo_Html
  • Jyxo_Input
    • Chain
    • Filter
    • Validator
  • Jyxo_Mail
    • Email
    • Parser
    • Sender
  • Jyxo_Rpc
    • Json
    • Xml
  • Jyxo_Shell
  • Jyxo_SpamFilter
  • Jyxo_Spl
  • Jyxo_String
  • Jyxo_Svn
  • Jyxo_Time
  • Jyxo_Timer
  • Jyxo_Webdav
  • Jyxo_XmlReader
  • PHP

Classes

  • Jyxo_Rpc_Xml_Client
  • Jyxo_Rpc_Xml_Server

Exceptions

  • Jyxo_Rpc_Xml_Exception
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * Jyxo PHP Library
 5:  *
 6:  * LICENSE
 7:  *
 8:  * This source file is subject to the new BSD license that is bundled
 9:  * with this package in the file license.txt.
10:  * It is also available through the world-wide-web at this URL:
11:  * https://github.com/jyxo/php/blob/master/license.txt
12:  */
13: 
14: /**
15:  * Class for creating a XML-RPC server.
16:  *
17:  * @category Jyxo
18:  * @package Jyxo_Rpc
19:  * @subpackage Xml
20:  * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
21:  * @license https://github.com/jyxo/php/blob/master/license.txt
22:  * @author Jaroslav HanslĂ­k
23:  */
24: class Jyxo_Rpc_Xml_Server extends Jyxo_Rpc_Server
25: {
26:     /**
27:      * Server instance.
28:      *
29:      * @var resource
30:      */
31:     private $server = null;
32: 
33:     /**
34:      * Creates a class instance.
35:      */
36:     protected function __construct()
37:     {
38:         parent::__construct();
39:         $this->server = xmlrpc_server_create();
40:     }
41: 
42:     /**
43:      * Destroys a class instance.
44:      */
45:     public function __destruct()
46:     {
47:         parent::__destruct();
48:         if (is_resource($this->server)) {
49:             xmlrpc_server_destroy($this->server);
50:         }
51:     }
52: 
53:     /**
54:      * Actually registers a function to a server method.
55:      *
56:      * @param string $func Function definition
57:      */
58:     protected function register($func)
59:     {
60:         xmlrpc_server_register_method($this->server, $func, array($this, 'call'));
61:     }
62: 
63:     /**
64:      * Processes a request and sends a XML-RPC response.
65:      */
66:     public function process()
67:     {
68:         $options = array(
69:             'output_type' => 'xml',
70:             'verbosity' => 'pretty',
71:             'escaping' => array('markup'),
72:             'version' => 'xmlrpc',
73:             'encoding' => 'utf-8'
74:         );
75: 
76:         $response = xmlrpc_server_call_method($this->server, file_get_contents('php://input'), null, $options);
77:         header('Content-Type: text/xml; charset="utf-8"');
78:         echo $response;
79:     }
80: }
81: 
Jyxo PHP Library API documentation generated by ApiGen 2.3.0