X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=docs%2Fexamples%2FKISS_XMLRPC_Client.php;fp=docs%2Fexamples%2FKISS_XMLRPC_Client.php;h=35380db9853759d19df1b1ca6c1bd7cb0e54896e;hb=b562e34cf4f8c8fae7b8fe773e0eed71592b09c2;hp=0000000000000000000000000000000000000000;hpb=b1d7d87f91b5cdcf321cb103e1a315f639885d61;p=m6w6%2Fext-http diff --git a/docs/examples/KISS_XMLRPC_Client.php b/docs/examples/KISS_XMLRPC_Client.php new file mode 100644 index 0000000..35380db --- /dev/null +++ b/docs/examples/KISS_XMLRPC_Client.php @@ -0,0 +1,43 @@ +namespace = $namespace; + $this->request = new HttpRequest($url, HTTP_POST); + $this->request->setContentType('text/xml'); + } + + public function setOptions($options = array()) + { + return $this->request->setOptions($options); + } + + public function addOptions($options) + { + return $this->request->addOptions($options); + } + + public function __call($method, $params) + { + if ($this->namespace) { + $method = $this->namespace .'.'. $method; + } + $this->request->setPostData(xmlrpc_encode_request($method, $params)); + $response = $this->request->send(); + if ($response->getResponseCode() != 200) { + throw new Exception($response->getBody(), $response->getResponseCode()); + } + return xmlrpc_decode($response->getBody(), 'utf-8'); + } + + public function getHistory() + { + return $this->request->getHistory(); + } +} + +?>