ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Client.php
Go to the documentation of this file.
1<?php
2
3/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
4
5// LICENSE AGREEMENT. If folded, press za here to unfold and read license {{{
6
40// }}}
41
42// dependencies {{{
43require_once 'XML/RPC2/Exception.php';
44require_once 'XML/RPC2/Util/HTTPRequest.php';
45require_once 'XML/RPC2/Value.php';
46require_once 'XML/RPC2/Client.php';
47require_once 'XML/RPC2/Backend/Php/Request.php';
48require_once 'XML/RPC2/Backend/Php/Response.php';
49// }}}
50
65{
66
67 // {{{ constructor
68
78 public function __construct($uri, $options = array())
79 {
80 parent::__construct($uri, $options);
81 }
82
83 // }}}
84 // {{{ remoteCall___()
85
95 public function remoteCall___($methodName, $parameters)
96 {
97 $request = new XML_RPC2_Backend_Php_Request($this->prefix . $methodName, $this->encoding);
98 $request->setParameters($parameters);
99 $request = $request->encode();
101 $options = array(
102 'encoding' => $this->encoding,
103 'proxy' => $this->proxy,
104 'sslverify' => $this->sslverify
105 );
106 $httpRequest = new XML_RPC2_Util_HTTPRequest($uri, $options);
107 $httpRequest->setPostData($request);
108 $httpRequest->sendRequest();
109 $body = $httpRequest->getBody();
110 if ($this->debug) {
111 $this->displayDebugInformations___($request, $body);
112 }
113 try {
114 $result = XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($body));
115 } catch (XML_RPC2_Exception $e) {
116 if ($this->debug) {
117 if (get_class($e)=='XML_RPC2_FaultException') {
118 print "XML_RPC2_FaultException #" . $e->getFaultCode() . " : " . $e->getMessage();
119 } else {
120 print get_class($e) . " : " . $e->getMessage();
121 }
122 }
123 throw $e;
124 }
125 if ($this->debug) {
127 }
128 return $result;
129 }
130
131 // }}}
132
133}
134
135?>
$result
__construct($uri, $options=array())
Construct a new XML_RPC2_Client PHP Backend.
Definition: Client.php:78
remoteCall___($methodName, $parameters)
remoteCall executes the XML-RPC call, and returns the result
Definition: Client.php:95
static decode(SimpleXMLElement $xml)
Parse a response and either return the native PHP result.
Definition: Response.php:125
displayDebugInformations___($request, $body)
Display debug informations.
Definition: Client.php:248
displayDebugInformations2___($result)
Display debug informations (part 2)
Definition: Client.php:270
if(! $in) print
if(!is_array($argv)) $options