wip
This commit is contained in:
1 parent
336af556a1
commit
8578ec96bb
6 files changed
+54
-71
No files matched your search
@@ -17,7 +17,7 @@ class Curl
|
||||
|
||||
if ($debug) {
|
||||
if ($proxy) {
|
||||
Notice::note($url.PHP_EOL.Nuh::$options['proxy'], 'b');
|
||||
Notice::note($url . PHP_EOL . Nuh::$options['proxy'], 'b');
|
||||
} else {
|
||||
Notice::note($url, 'g');
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class Curl
|
||||
if ($debug) {
|
||||
Notice::note('data read localy', 'g');
|
||||
}
|
||||
$filename = app_path().self::$testfiles.strtolower(str_replace(' ', '_', Nuh::$options['name'])).'.json';
|
||||
$filename = app_path() . self::$testfiles . strtolower(str_replace(' ', '_', Nuh::$options['name'])) . '.json';
|
||||
|
||||
$file = file_get_contents($filename);
|
||||
|
||||
@@ -37,7 +37,7 @@ class Curl
|
||||
$file = self::fetch_data_with_retries($url, $_config);
|
||||
|
||||
if ($save) {
|
||||
$filename = app_path().self::$testfiles.strtolower(str_replace(' ', '_', Nuh::$options['name'])).'.json';
|
||||
$filename = app_path() . self::$testfiles . strtolower(str_replace(' ', '_', Nuh::$options['name'])) . '.json';
|
||||
|
||||
file_put_contents($filename, $file);
|
||||
|
||||
@@ -125,20 +125,17 @@ class Curl
|
||||
$attempt++;
|
||||
$curl_errorno = curl_errno($ch);
|
||||
if ($debug && $curl_errorno) {
|
||||
Notice::note('curl_errorno: '.self::curlerrorcode($curl_errorno));
|
||||
Notice::note('curl_errorno: ' . self::curlerrorcode($curl_errorno));
|
||||
}
|
||||
if ($debug) {
|
||||
echo "Attempt $attempt failed. Retrying...\n";
|
||||
}
|
||||
sleep(2); // Optional: Sleep between retries
|
||||
} else {
|
||||
curl_close($ch);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
echo "All attempts failed.\n";
|
||||
curl_close($ch);
|
||||
|
||||
return null; // Return null if all retries fail
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user