summaryrefslogtreecommitdiffstats
path: root/feed/client/httpclient.php
diff options
context:
space:
mode:
Diffstat (limited to 'feed/client/httpclient.php')
-rw-r--r--feed/client/httpclient.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/feed/client/httpclient.php b/feed/client/httpclient.php
new file mode 100644
index 000000000..2fad3ea68
--- /dev/null
+++ b/feed/client/httpclient.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Alessandro Cosentino 2012
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+
+namespace OCA\News\Feed\Client;
+
+class HttpClient {
+
+ protected $defaults = [
+ 'user_agent' => 'ownCloud News/VERSION ' .
+ '(+https://owncloud.org/; 1 subscriber; feed-url=URL)',
+ 'connection_timeout' => 10, // seconds
+ 'timeout' => 10, // seconds
+ 'verify_ssl' => true,
+ 'http_version' => '1.1',
+ 'proxy_host' => '',
+ 'proxy_port' => 80,
+ 'proxy_user' => '',
+ 'proxy_password' => ''
+ ];
+
+ public function __construct ($version, array $config=null) {
+ foreach ($config as $key => $value) {
+ $this->defaults[$key] = $value;
+ }
+
+ $this->defaults['user_agent'] = str_replace('VERSION', $version,
+ $this->defaults['user_agent']);
+ }
+
+
+ public abstract function get($url);
+
+}
+
+