}
}
- /**
- * Returns the current UserAgent as a String
- *
- * @return string the UserAgent as a String
- * @throws HTTPException\InternalServerErrorException
- */
- public function getUserAgent()
- {
- return
- FRIENDICA_PLATFORM . " '" .
- FRIENDICA_CODENAME . "' " .
- FRIENDICA_VERSION . '-' .
- DB_UPDATE_VERSION . '; ' .
- $this->baseURL->get();
- }
-
/**
* Returns the current theme name. May be overriden by the mobile theme name.
*
$ch = @curl_init($match[1]);
@curl_setopt($ch, CURLOPT_NOBODY, true);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- @curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
+ @curl_setopt($ch, CURLOPT_USERAGENT, DI::httpRequest()->getUserAgent());
@curl_exec($ch);
$curl_info = @curl_getinfo($ch);
$ch = @curl_init($match[1]);
@curl_setopt($ch, CURLOPT_NOBODY, true);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- @curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
+ @curl_setopt($ch, CURLOPT_USERAGENT, DI::httpRequest()->getUserAgent());
@curl_exec($ch);
$curl_info = @curl_getinfo($ch);
/** @var IConfig */
private $config;
/** @var string */
- private $userAgent;
+ private $baseUrl;
- public function __construct(LoggerInterface $logger, Profiler $profiler, IConfig $config, App $a)
+ public function __construct(LoggerInterface $logger, Profiler $profiler, IConfig $config, App\BaseURL $baseUrl)
{
- $this->logger = $logger;
- $this->profiler = $profiler;
- $this->config = $config;
- $this->userAgent = $a->getUserAgent();
+ $this->logger = $logger;
+ $this->profiler = $profiler;
+ $this->config = $config;
+ $this->baseUrl = $baseUrl->get();
}
/**
$stamp1 = microtime(true);
if (Network::isUrlBlocked($url)) {
- $this->logger->info('Domain is blocked.'. ['url' => $url]);
+ $this->logger->info('Domain is blocked.' . ['url' => $url]);
return CurlResult::createErrorCurl($url);
}
$redirects
);
}
+
+ /**
+ * Returns the current UserAgent as a String
+ *
+ * @return string the UserAgent as a String
+ */
+ public function getUserAgent()
+ {
+ return
+ FRIENDICA_PLATFORM . " '" .
+ FRIENDICA_CODENAME . "' " .
+ FRIENDICA_VERSION . '-' .
+ DB_UPDATE_VERSION . '; ' .
+ $this->baseUrl;
+ }
}
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
+ curl_setopt($ch, CURLOPT_USERAGENT, DI::httpRequest()->getUserAgent());
curl_exec($ch);
$curl_info = @curl_getinfo($ch);
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
+ curl_setopt($ch, CURLOPT_USERAGENT, DI::httpRequest()->getUserAgent());
$body = curl_exec($ch);
curl_close($ch);