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/Client.php';
45require_once 'XML/RPC2/Util/HTTPRequest.php';
46//}}}
47
59{
60
61 // {{{ constructor
62
72 public function __construct($uri, $options = array())
73 {
74 parent::__construct($uri, $options);
75 }
76
77 // }}}
78 // {{{ remoteCall()
79
89 public function remoteCall___($methodName, $parameters)
90 {
91 $tmp = xmlrpc_encode_request($this->prefix . $methodName, $parameters, array('encoding' => $this->encoding));
92 if ($this->uglyStructHack) {
93 // ugly hack because of http://bugs.php.net/bug.php?id=21949
94 // see XML_RPC2_Backend_Xmlrpcext_Value::createFromNative() from more infos
95 $request = preg_replace('~<name>xml_rpc2_ugly_struct_hack_(.*)</name>~', '<name>\1</name>', $tmp);
96 } else {
97 $request = $tmp;
98 }
100 $options = array(
101 'encoding' => $this->encoding,
102 'proxy' => $this->proxy,
103 'sslverify' => $this->sslverify
104 );
105 $httpRequest = new XML_RPC2_Util_HTTPRequest($uri, $options);
106 $httpRequest->setPostData($request);
107 $httpRequest->sendRequest();
108 $body = $httpRequest->getBody();
109 if ($this->debug) {
110 $this->displayDebugInformations___($request, $body);
111 }
112 $result = xmlrpc_decode($body, $this->encoding);
113 /* Commented due to change in behaviour from xmlrpc_decode. It does not return faults now
114 if ($result === false || is_null($result)) {
115 if ($this->debug) {
116 print "XML_RPC2_Exception : unable to decode response !";
117 }
118 throw new XML_RPC2_Exception('Unable to decode response');
119 }
120 */
121 if (xmlrpc_is_fault($result)) {
122 if ($this->debug) {
123 print "XML_RPC2_FaultException(${result['faultString']}, ${result['faultCode']})";
124 }
125 throw new XML_RPC2_FaultException($result['faultString'], $result['faultCode']);
126 }
127 if ($this->debug) {
129 }
130 return $result;
131 }
132
133 // }}}
134
135}
136
137?>
$result
__construct($uri, $options=array())
Construct a new XML_RPC2_Client PHP Backend.
Definition: Client.php:72
remoteCall___($methodName, $parameters)
remoteCall executes the XML-RPC call, and returns the result
Definition: Client.php:89
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