From b412c7c8cf4e73f41547e16dfd3797802386c802 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 18 May 2023 21:25:12 +0200 Subject: [PATCH] Only break on rate limit (otherwise coninue) --- application/controllers/Eqsl.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 5343bcd5..6a41e850 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -561,10 +561,14 @@ class eqsl extends CI_Controller { $q = $query->row(); $username = $q->user_eqsl_name; $password = $q->user_eqsl_password; + $error = ''; $image_url = $this->electronicqsl->card_image($username, urlencode($password), $callsign, $band, $mode, $year, $month, $day, $hour, $minute); $file = file_get_contents($image_url, true); - $error = ''; + if (str_contains($file, 'Error')) { + $error = preg_replace('/^\s*Error: /', '', $file); + return $error.' (QSO ID: '.$id.')'; + } $dom = new domDocument; $dom->loadHTML($file); @@ -617,8 +621,12 @@ class eqsl extends CI_Controller { foreach ($qslsnotdownloaded->result_array() as $qsl) { $error = $this->bulk_download_image($qsl['COL_PRIMARY_KEY']); if ($error != '') { - print "Error: ".$error; - break; + if ($error == 'Rate Limited') { + break; + } else { + print "Error: ".$error."
"; + continue; + } } sleep(15); }