10 defined(
'JPATH_PLATFORM') or die;
44 $this->options = isset($options) ? $options :
new JRegistry;
57 public function getOption($key)
59 return $this->options->get($key);
72 public function setOption($key, $value)
74 $this->options->set($key, $value);
90 public function options($url, array $headers = null, $timeout = null)
93 $temp = (array) $this->options->get(
'headers');
95 foreach ($temp as $key => $val)
97 if (!isset($headers[$key]))
99 $headers[$key] = $val;
104 if ($timeout === null && $this->options->exists(
'timeout'))
106 $timeout = $this->options->get(
'timeout');
109 return $this->transport->request(
'OPTIONS',
new JUri($url), null, $headers, $timeout, $this->options->get(
'userAgent', null));
123 public function head($url, array $headers = null, $timeout = null)
126 $temp = (array) $this->options->get(
'headers');
128 foreach ($temp as $key => $val)
130 if (!isset($headers[$key]))
132 $headers[$key] = $val;
137 if ($timeout === null && $this->options->exists(
'timeout'))
139 $timeout = $this->options->get(
'timeout');
142 return $this->transport->request(
'HEAD',
new JUri($url), null, $headers, $timeout, $this->options->get(
'userAgent', null));
156 public function get($url, array $headers = null, $timeout = null)
159 $temp = (array) $this->options->get(
'headers');
161 foreach ($temp as $key => $val)
163 if (!isset($headers[$key]))
165 $headers[$key] = $val;
170 if ($timeout === null && $this->options->exists(
'timeout'))
172 $timeout = $this->options->get(
'timeout');
175 return $this->transport->request(
'GET',
new JUri($url), null, $headers, $timeout, $this->options->get(
'userAgent', null));
190 public function post($url, $data, array $headers = null, $timeout = null)
193 $temp = (array) $this->options->get(
'headers');
195 foreach ($temp as $key => $val)
197 if (!isset($headers[$key]))
199 $headers[$key] = $val;
204 if ($timeout === null && $this->options->exists(
'timeout'))
206 $timeout = $this->options->get(
'timeout');
209 return $this->transport->request(
'POST',
new JUri($url), $data, $headers, $timeout, $this->options->get(
'userAgent', null));
224 public function put($url, $data, array $headers = null, $timeout = null)
227 $temp = (array) $this->options->get(
'headers');
229 foreach ($temp as $key => $val)
231 if (!isset($headers[$key]))
233 $headers[$key] = $val;
238 if ($timeout === null && $this->options->exists(
'timeout'))
240 $timeout = $this->options->get(
'timeout');
243 return $this->transport->request(
'PUT',
new JUri($url), $data, $headers, $timeout, $this->options->get(
'userAgent', null));
257 public function delete($url, array $headers = null, $timeout = null)
260 $temp = (array) $this->options->get(
'headers');
262 foreach ($temp as $key => $val)
264 if (!isset($headers[$key]))
266 $headers[$key] = $val;
271 if ($timeout === null && $this->options->exists(
'timeout'))
273 $timeout = $this->options->get(
'timeout');
276 return $this->transport->request(
'DELETE',
new JUri($url), null, $headers, $timeout, $this->options->get(
'userAgent', null));
290 public function trace($url, array $headers = null, $timeout = null)
293 $temp = (array) $this->options->get(
'headers');
295 foreach ($temp as $key => $val)
297 if (!isset($headers[$key]))
299 $headers[$key] = $val;
304 if ($timeout === null && $this->options->exists(
'timeout'))
306 $timeout = $this->options->get(
'timeout');
309 return $this->transport->request(
'TRACE',
new JUri($url), null, $headers, $timeout, $this->options->get(
'userAgent', null));
324 public function patch($url, $data, array $headers = null, $timeout = null)
327 $temp = (array) $this->options->get(
'headers');
329 foreach ($temp as $key => $val)
331 if (!isset($headers[$key]))
333 $headers[$key] = $val;
338 if ($timeout === null && $this->options->exists(
'timeout'))
340 $timeout = $this->options->get(
'timeout');
343 return $this->transport->request(
'PATCH',
new JUri($url), $data, $headers, $timeout, $this->options->get(
'userAgent', null));