summaryrefslogtreecommitdiff
path: root/providers/HtmlFeed.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-01-31 21:09:58 +0100
committeremkael <emkael@tlen.pl>2019-01-31 21:09:58 +0100
commite1056ce60855b0a6ece9f49ae5b96b6c9c52ab08 (patch)
tree79e175ffe58a394bde6e130f4cbec27854dbb2de /providers/HtmlFeed.php
parentaa19ac70447506b64c78ab38a6a3031f7effa31a (diff)
Reading HtmlFeed user agent from config file
Diffstat (limited to 'providers/HtmlFeed.php')
-rw-r--r--providers/HtmlFeed.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/providers/HtmlFeed.php b/providers/HtmlFeed.php
index 411cddf..64d6259 100644
--- a/providers/HtmlFeed.php
+++ b/providers/HtmlFeed.php
@@ -7,10 +7,12 @@ require_once('../lib/querypath/src/qp.php');
abstract class HtmlFeed extends \Providers\XmlFeed {
- const HTML_FEED_USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)';
-
private $_encoding;
+ private function __getUserAgent() {
+ return trim(file_get_contents('../config/user-agent'));
+ }
+
private function __getHttpContent($feedUrl) {
$header = array();
$header[] = 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
@@ -20,7 +22,7 @@ abstract class HtmlFeed extends \Providers\XmlFeed {
$header[] = 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7';
$header[] = 'Pragma: ';
$ch = curl_init($feedUrl);
- curl_setopt($ch, CURLOPT_USERAGENT, self::HTML_FEED_USER_AGENT);
+ curl_setopt($ch, CURLOPT_USERAGENT, $this->__getUserAgent());
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);