Overview

Namespaces

  • Jyxo
    • Beholder
      • TestCase
    • Gettext
      • Parser
    • Input
      • Chain
      • Filter
      • Validator
    • Mail
      • Email
        • Attachment
      • Parser
      • Sender
    • Rpc
      • Json
      • Xml
    • Shell
    • Spl
    • Svn
    • Time
    • Webdav
  • PHP

Classes

  • Client
  • Server

Exceptions

  • Exception
  • Overview
  • Namespace
  • 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: namespace Jyxo\Rpc\Xml;
15: 
16: /**
17:  * Class for creating a XML-RPC server.
18:  *
19:  * @category Jyxo
20:  * @package Jyxo\Rpc
21:  * @subpackage Xml
22:  * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
23:  * @license https://github.com/jyxo/php/blob/master/license.txt
24:  * @author Jaroslav HanslĂ­k
25:  */
26: class Server extends \Jyxo\Rpc\Server
27: {
28:     /**
29:      * Server instance.
30:      *
31:      * @var resource
32:      */
33:     private $server = null;
34: 
35:     /**
36:      * Creates a class instance.
37:      */
38:     protected function __construct()
39:     {
40:         parent::__construct();
41:         $this->server = xmlrpc_server_create();
42:     }
43: 
44:     /**
45:      * Destroys a class instance.
46:      */
47:     public function __destruct()
48:     {
49:         parent::__destruct();
50:         if (is_resource($this->server)) {
51:             xmlrpc_server_destroy($this->server);
52:         }
53:     }
54: 
55:     /**
56:      * Actually registers a function to a server method.
57:      *
58:      * @param string $func Function definition
59:      */
60:     protected function register($func)
61:     {
62:         xmlrpc_server_register_method($this->server, $func, array($this, 'call'));
63:     }
64: 
65:     /**
66:      * Processes a request and sends a XML-RPC response.
67:      */
68:     public function process()
69:     {
70:         $options = array(
71:             'output_type' => 'xml',
72:             'verbosity' => 'pretty',
73:             'escaping' => array('markup'),
74:             'version' => 'xmlrpc',
75:             'encoding' => 'utf-8'
76:         );
77: 
78:         $response = xmlrpc_server_call_method($this->server, file_get_contents('php://input'), null, $options);
79:         header('Content-Type: text/xml; charset="utf-8"');
80:         echo $response;
81:     }
82: }
83: 
Jyxo PHP Library API documentation generated by ApiGen 2.3.0