diff options
Diffstat (limited to 'lib/contents.php')
-rw-r--r-- | lib/contents.php | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/contents.php b/lib/contents.php index 56a3db20..b4d70817 100644 --- a/lib/contents.php +++ b/lib/contents.php @@ -24,6 +24,13 @@ function getContents( // TODO: consider url validation at this point + $config = [ + 'useragent' => Configuration::getConfig('http', 'useragent'), + 'timeout' => Configuration::getConfig('http', 'timeout'), + 'retries' => Configuration::getConfig('http', 'retries'), + 'curl_options' => $curlOptions, + ]; + $httpHeadersNormalized = []; foreach ($httpHeaders as $httpHeader) { $parts = explode(':', $httpHeader); @@ -69,13 +76,7 @@ function getContents( 'TE' => 'trailers', ]; - $config = [ - 'useragent' => Configuration::getConfig('http', 'useragent'), - 'timeout' => Configuration::getConfig('http', 'timeout'), - 'retries' => Configuration::getConfig('http', 'retries'), - 'headers' => array_merge($defaultHttpHeaders, $httpHeadersNormalized), - 'curl_options' => $curlOptions, - ]; + $config['headers'] = array_merge($defaultHttpHeaders, $httpHeadersNormalized); $maxFileSize = Configuration::getConfig('http', 'max_filesize'); if ($maxFileSize) { @@ -176,11 +177,9 @@ function getSimpleHTMLDOM( } /** - * Gets contents from the Internet as simplhtmldom object. Contents are cached + * Fetch contents from the Internet as simplhtmldom object. Contents are cached * and re-used for subsequent calls until the cache duration elapsed. * - * _Notice_: Cached contents are forcefully removed after 24 hours (86400 seconds). - * * @param string $url The URL. * @param int $ttl Cache duration in seconds. * @param array $header (optional) A list of cURL header. |