wip
This commit is contained in:
1 parent
336af556a1
commit
8578ec96bb
6 files changed
+54
-71
No files matched your search
@@ -16,14 +16,14 @@ class Xml
|
||||
$save = Nuh::$options['s'] ?? 0;
|
||||
$read = Nuh::$options['r'] ?? 0;
|
||||
|
||||
$filename = app_path().'/Console/Commands/TestFiles/'.strtolower(str_replace(' ', '_', Nuh::$options['name'])).'.xml';
|
||||
$filename = app_path() . '/Console/Commands/TestFiles/' . strtolower(str_replace(' ', '_', Nuh::$options['name'])) . '.xml';
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("Loading URL\n".$url);
|
||||
Notice::note("Loading URL\n" . $url);
|
||||
}
|
||||
|
||||
if ($save || $read) {
|
||||
Notice::note("FILE NAME\n".$filename);
|
||||
Notice::note("FILE NAME\n" . $filename);
|
||||
}
|
||||
|
||||
if ($read) {
|
||||
@@ -96,16 +96,14 @@ class Xml
|
||||
echo "Attempt $attempt failed. Retrying...\n";
|
||||
sleep(2); // Optional: Sleep between retries
|
||||
} else {
|
||||
curl_close($ch);
|
||||
if (mb_substr($response, 0, 1) != '<') {
|
||||
Log::debug('INVALID XML '.$url.'----'.$response);
|
||||
Log::debug('INVALID XML ' . $url . '----' . $response);
|
||||
} else {
|
||||
return new SimpleXMLElement($response);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "All attempts failed.\n";
|
||||
curl_close($ch);
|
||||
|
||||
return null; // Return null if all retries fail
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user