10 defined(
'JPATH_PLATFORM') or die;
44 $this->options = isset($options) ? $options :
new JRegistry;
45 $this->client = isset($client) ? $client :
new JMediawikiHttp($this->options);
57 protected function fetchUrl($path)
60 $path .=
'&format=xml';
62 $uri =
new JUri($this->options->get(
'api.url') .
'/api.php' . $path);
64 if ($this->options->get(
'api.username',
false))
66 $uri->
setUser($this->options->get(
'api.username'));
69 if ($this->options->get(
'api.password',
false))
71 $uri->setPass($this->options->get(
'api.password'));
86 public function buildParameter(array $params)
90 foreach ($params as $param)
94 if (next($params) ==
true)
112 public function validateResponse($response)
114 $xml = simplexml_load_string($response->body);
116 if (isset($xml->warnings))
118 throw new DomainException($xml->warnings->info);
121 if (isset($xml->error))
123 throw new DomainException($xml->error[
'info']);