diff --git a/lib/G/functions.php b/lib/G/functions.php index 3a11357c..2b052468 100644 --- a/lib/G/functions.php +++ b/lib/G/functions.php @@ -1648,7 +1648,7 @@ function fetch_url($url, $file = null, $options = []) curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 60); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 0); curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); @@ -1689,7 +1689,7 @@ function fetch_url($url, $file = null, $options = []) } } else { $context = stream_context_create([ - 'http' => ['ignore_errors' => true], + 'http' => ['ignore_errors' => true, 'follow_location' => false], ]); $result = @file_get_contents($url, false, $context); if (!$result) { @@ -1718,7 +1718,7 @@ function getUrlHeaders($url, $options = []) curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36'); // Inject custom options