From 2e128befdac4ee892d82e09fc6c299ec6e8aad29 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 30 Sep 2013 21:18:27 +0200 Subject: set the useragent when getting the full body for the xpath enhancer --- articleenhancer/xpatharticleenhancer.php | 4 ++-- utility/simplepiefilefactory.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/articleenhancer/xpatharticleenhancer.php b/articleenhancer/xpatharticleenhancer.php index 77a16f04d..93ceaf896 100644 --- a/articleenhancer/xpatharticleenhancer.php +++ b/articleenhancer/xpatharticleenhancer.php @@ -61,7 +61,7 @@ class XPathArticleEnhancer implements ArticleEnhancer { foreach($this->regexXPathPair as $regex => $search) { if(preg_match($regex, $item->getUrl())) { - $file = $this->fileFactory->getFile($item->getUrl(), $this->maximumTimeout); + $file = $this->fileFactory->getFile($item->getUrl(), $this->maximumTimeout, "Mozilla/5.0 AppleWebKit"); // convert encoding by detecting charset from header $contentType = $file->headers['content-type']; @@ -215,4 +215,4 @@ class XPathArticleEnhancer implements ArticleEnhancer { } -} \ No newline at end of file +} diff --git a/utility/simplepiefilefactory.php b/utility/simplepiefilefactory.php index 13b56dc9e..5f1867c38 100644 --- a/utility/simplepiefilefactory.php +++ b/utility/simplepiefilefactory.php @@ -28,8 +28,8 @@ namespace OCA\News\Utility; class SimplePieFileFactory { - public function getFile($url, $timeout) { - return new \SimplePie_File($url, $timeout); + public function getFile($url, $timeout, $userAgent = null) { + return new \SimplePie_File($url, $timeout, null, null, $userAgent); } -} \ No newline at end of file +} -- cgit v1.2.3