This commit is contained in:
salam committed 2025-12-18 19:22:36 +01:00
1 parent 60379bcab8
commit 5c9745b1da
19 files changed
+167 -105

No files matched your search

+13 -6
View File
@@ -8,11 +8,11 @@ class Curl
{
public static $file;
public static function load($url)
public static function load($url, $proxy = false)
{
$debug = NuhBash::$options['d'] ?? 0;
$save = NuhBash::$options['s'] ?? 0;
$read = NuhBash::$options['r'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
$save = Nuh::$options['s'] ?? 0;
$read = Nuh::$options['r'] ?? 0;
if ($debug) {
Notice::note($url);
@@ -22,7 +22,7 @@ class Curl
if ($debug) {
Notice::note('READ LOCAL', 'r');
}
$filename = app_path().'/Console/TestFiles/'.strtolower(str_replace(' ', '_', NuhBash::$options['name'])).'.json';
$filename = app_path().'/Console/TestFiles/'.strtolower(str_replace(' ', '_', Nuh::$options['name'])).'.json';
$file = file_get_contents($filename);
@@ -34,6 +34,13 @@ class Curl
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
if ($proxy) {
curl_setopt($request, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($request, CURLOPT_HTTPHEADER, [
'Proxy-Auth: $2y$12$/iKduDrM9HJA6T6t/5e5x.nkQ9KUNWLvTXhRwdU.EN2Twfwlr4jzu',
'Proxy-Target-URL: '.$url,
]);
}
$data = curl_exec($ch);
$curl_errorno = curl_errno($ch);
if ($curl_errorno) {
@@ -46,7 +53,7 @@ class Curl
if ($save) {
Notice::note('SAVED LOCAL', 'b');
self::$file = app_path().'/Console/TestFiles/'.strtolower(str_replace(' ', '_', NuhBash::$options['name'])).'.json';
self::$file = app_path().'/Console/TestFiles/'.strtolower(str_replace(' ', '_', Nuh::$options['name'])).'.json';
file_put_contents(self::$file, $data);
}