X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=lib%2FXmlRpcClient.php;h=488e1cf0c59e91f25f6406acedb56c0b9bc0bc58;hp=83a154e933448a37883e4d5e1bf3ffbc32f63823;hb=9c3bc2cb7b5217a91a8defbbe7c5c20f33938d59;hpb=ebf03950ffaea849b931adf83b6c20ac9fb7ef33 diff --git a/lib/XmlRpcClient.php b/lib/XmlRpcClient.php index 83a154e..488e1cf 100644 --- a/lib/XmlRpcClient.php +++ b/lib/XmlRpcClient.php @@ -22,7 +22,7 @@ * @copyright Michael Wallner, * @license BSD, revised * @package pecl/http - * @version $Revision$ + * @version $Revision$ */ class XmlRpcClient { @@ -54,10 +54,9 @@ class XmlRpcClient * @param string $namespace RPC namespace * @param array $options HttpRequest options */ - public function __construct($url, $namespace = '', array $options = null) + public function __construct($url, $namespace = '', array $options = array()) { - $this->__request = new HttpRequest($url, HTTP_METH_POST); - $this->__request->setOptions($options); + $this->__request = new HttpRequest($url, HttpRequest::METH_POST, $options); $this->__namespace = $namespace; } @@ -71,14 +70,14 @@ class XmlRpcClient */ public function __call($method, array $params) { - if ($this->__namespace) { + if (strlen($this->__namespace)) { $method = $this->__namespace .'.'. $method; } - $this->__request->setContentType("text/xml; charset=". $this->__encoding); - $request = xmlrpc_encode_request($method, $params, array("encoding" => $this->__encoding)); - $this->__request->setRawPostData($request); - $this->__request->send(); - $response = $this->__request->getResponseMessage(); + $this->__request->setContentType("text/xml"); + $this->__request->setRawPostData( + xmlrpc_encode_request($method, $params, + array("encoding" => $this->__encoding))); + $response = $this->__request->send(); if ($response->getResponseCode() != 200) { throw new Exception( $response->getResponseStatus(),