diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-10 19:15:31 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-10 19:15:31 +0200 |
commit | 5befce51ef9f38609b713cfbc6095a3b60b1d574 (patch) | |
tree | 0bbe540c109afa83086ed7ad43adb8a215e54633 /fetcher | |
parent | db545b430a513e7fda3fba5859972b6c550958b5 (diff) |
add proxy support based on simplepie pr, fix #491
Diffstat (limited to 'fetcher')
-rw-r--r-- | fetcher/feedfetcher.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fetcher/feedfetcher.php b/fetcher/feedfetcher.php index c00a8c859..6808465c2 100644 --- a/fetcher/feedfetcher.php +++ b/fetcher/feedfetcher.php @@ -42,6 +42,9 @@ class FeedFetcher implements IFeedFetcher { private $simplePieFactory; private $fetchTimeout; private $time; + private $proxyHost; + private $proxyPort; + private $proxyAuth; public function __construct(API $api, SimplePieAPIFactory $simplePieFactory, @@ -56,6 +59,9 @@ class FeedFetcher implements IFeedFetcher { $this->faviconFetcher = $faviconFetcher; $this->simplePieFactory = $simplePieFactory; $this->time = $time; + $this->proxyHost = $config->getProxyHost(); + $this->proxyPort = $config->getProxyPort(); + $this->proxyAuth = $config->getProxyAuth(); } @@ -83,6 +89,12 @@ class FeedFetcher implements IFeedFetcher { $simplePie->set_cache_location($this->cacheDirectory); $simplePie->set_cache_duration($this->cacheDuration); + if(trim($this->proxyHost) !== '') { + $simplePie->set_proxyhost($this->proxyHost); + $simplePie->set_proxyport($this->proxyPort); + $simplePie->set_proxyuserpwd($this->proxyAuth); + } + if (!$simplePie->init()) { throw new FetcherException('Could not initialize simple pie on feed with url ' . $url); } |