fix Curl::load timeout error
This commit is contained in:
1 parent
30003b7d3d
commit
c3c8f6a393
7 files changed
+18
-6
No files matched your search
@@ -70,7 +70,7 @@ class Curl
|
||||
public static function fetch_data_with_retries($url, $_config = [], $max_retries = 3)
|
||||
{
|
||||
$attempt = 0;
|
||||
$timeout = 10; // seconds
|
||||
$timeout = 5; // seconds
|
||||
$connect_timeout = 5; // seconds
|
||||
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
@@ -136,7 +136,7 @@ class Curl
|
||||
echo "All attempts failed.\n";
|
||||
curl_close($ch);
|
||||
|
||||
return null; // Return null if all retries fail
|
||||
return json_encode(['no data']); // Return null if all retries fail
|
||||
}
|
||||
|
||||
public static function curlerrorcode($id)
|
||||
|
||||
@@ -36,6 +36,10 @@ class Bwin
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (! isset($data['pager'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$total = round($data['pager']['total'] / $data['pager']['per_page']);
|
||||
|
||||
if ($debug) {
|
||||
|
||||
@@ -58,6 +58,10 @@ class Fixtures
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (! isset($data['pager'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$page++;
|
||||
|
||||
if (isset($data['pager']['total'])) {
|
||||
|
||||
@@ -74,6 +74,10 @@ class Fixtures
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (! count($data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($data as $magloo) {
|
||||
|
||||
// print_r($magloo);
|
||||
|
||||
Reference in new issue
Block a user