fix errror curl
This commit is contained in:
1 parent
c3c8f6a393
commit
1156680b77
3 files changed
+11
-3
No files matched your search
@@ -70,9 +70,13 @@ class Curl
|
|||||||
public static function fetch_data_with_retries($url, $_config = [], $max_retries = 3)
|
public static function fetch_data_with_retries($url, $_config = [], $max_retries = 3)
|
||||||
{
|
{
|
||||||
$attempt = 0;
|
$attempt = 0;
|
||||||
$timeout = 5; // seconds
|
$timeout = 10;
|
||||||
$connect_timeout = 5; // seconds
|
$connect_timeout = 5; // seconds
|
||||||
|
|
||||||
|
if (isset($_config['timeout'])) {
|
||||||
|
$timeout = $_config['timeout'];
|
||||||
|
}
|
||||||
|
|
||||||
$debug = Nuh::$options['d'] ?? 0;
|
$debug = Nuh::$options['d'] ?? 0;
|
||||||
$proxy = Nuh::$options['p'] ?? 0;
|
$proxy = Nuh::$options['p'] ?? 0;
|
||||||
|
|
||||||
@@ -136,7 +140,7 @@ class Curl
|
|||||||
echo "All attempts failed.\n";
|
echo "All attempts failed.\n";
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
return json_encode(['no data']); // Return null if all retries fail
|
return null; // Return null if all retries fail
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function curlerrorcode($id)
|
public static function curlerrorcode($id)
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ class Logifuture
|
|||||||
|
|
||||||
$matches = LogifutureData::load($logifuture_sport_id);
|
$matches = LogifutureData::load($logifuture_sport_id);
|
||||||
|
|
||||||
|
if (! is_array($matches)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (! isset($matches['error'])) {
|
if (! isset($matches['error'])) {
|
||||||
|
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Odds
|
|||||||
|
|
||||||
$url = Nuh::$options['base_url'].'/1/prematch/sport/'.$magloo_sport_id.'/odds';
|
$url = Nuh::$options['base_url'].'/1/prematch/sport/'.$magloo_sport_id.'/odds';
|
||||||
|
|
||||||
$data = Curl::load($url);
|
$data = Curl::load($url, ['timeout' => 30]);
|
||||||
|
|
||||||
if (! is_array($data) or \count($data) == 0) {
|
if (! is_array($data) or \count($data) == 0) {
|
||||||
Notice::note('no data in feed', 'r', 1);
|
Notice::note('no data in feed', 'r', 1);
|
||||||
|
|||||||
Reference in new issue
Block a user