disable fetch url follow redirect

This commit is contained in:
Rodolfo Berrios 2022-01-07 13:21:16 -03:00
parent e30ce8f0e9
commit 58603172b1
No known key found for this signature in database
GPG key ID: D3AAC2481DBDD9FE

View file

@ -1648,7 +1648,7 @@ namespace G {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60); 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_HEADER, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
@ -1689,7 +1689,7 @@ namespace G {
} }
} else { } else {
$context = stream_context_create([ $context = stream_context_create([
'http' => ['ignore_errors' => true], 'http' => ['ignore_errors' => true, 'follow_location' => false],
]); ]);
$result = @file_get_contents($url, false, $context); $result = @file_get_contents($url, false, $context);
if (!$result) { if (!$result) {
@ -1718,7 +1718,7 @@ namespace G {
curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 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_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'); 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 // Inject custom options