diff options
Diffstat (limited to 'feed/client')
-rw-r--r-- | feed/client/curl.php | 25 | ||||
-rw-r--r-- | feed/client/httpclient.php | 45 |
2 files changed, 70 insertions, 0 deletions
diff --git a/feed/client/curl.php b/feed/client/curl.php new file mode 100644 index 000000000..3cacfe2aa --- /dev/null +++ b/feed/client/curl.php @@ -0,0 +1,25 @@ +<?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 CURL extends HttpClient { + + public function __construct ($version, array $config=null) { + parent::__construct($version, $config); + } + + +} + + 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); + +} + + |