Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
disable fetch url follow redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Jan 7, 2022
1 parent e30ce8f commit 5860317
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/G/functions.php
Expand Up @@ -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');
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5860317

Please sign in to comment.