http error send to telegram

This commit is contained in:
Ibnu Maksum 2024-06-26 17:39:05 +07:00
parent 5baac9d7d0
commit 7585129522
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/) * PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* by https://t.me/ibnux * by https://t.me/ibnux
@ -37,9 +38,15 @@ class Http
} }
curl_close($ch); curl_close($ch);
if ($admin && $error_msg) { if ($admin && $error_msg) {
r2(U . 'dashboard', 'd', $error_msg); Message::sendTelegram(
"Http::getData Error:\n" .
_get('_route') . "\n" .
"\n$url" .
"\n$error_msg"
);
return $error_msg;
} }
return ($server_output) ? $server_output : $error_msg; return (!empty($server_output)) ? $server_output : $error_msg;
} }
public static function postJsonData($url, $array_post, $headers = [], $basic = null) public static function postJsonData($url, $array_post, $headers = [], $basic = null)
@ -73,9 +80,15 @@ class Http
} }
curl_close($ch); curl_close($ch);
if ($admin && $error_msg) { if ($admin && $error_msg) {
r2(U . 'dashboard', 'd', $error_msg); Message::sendTelegram(
"Http::postJsonData:\n" .
_get('_route') . "\n" .
"\n$url" .
"\n$error_msg"
);
return $error_msg;
} }
return ($server_output) ? $server_output : $error_msg; return (!empty($server_output)) ? $server_output : $error_msg;
} }
@ -110,8 +123,14 @@ class Http
} }
curl_close($ch); curl_close($ch);
if ($admin && $error_msg) { if ($admin && $error_msg) {
r2(U . 'dashboard', 'd', $error_msg); Message::sendTelegram(
"Http::postData Error:\n" .
_get('_route') . "\n" .
"\n$url" .
"\n$error_msg"
);
return $error_msg;
} }
return ($server_output) ? $server_output : $error_msg; return (!empty($server_output)) ? $server_output : $error_msg;
} }
} }