Answer the question
In order to leave comments, you need to log in
How to get errors with php if you are not working through a browser?
Hello. I'm making myself a telegram bot in PHP and faced such an inconvenient situation - I don't see an error. This is due to the fact that I work not through a browser, but through Telegram. And if there is an error in the code, the script just stops. In order to somehow debug the code, I have to simulate (yeah). Simulate a request from a cart, substitute it into variables and open the page from the browser. Firstly, it's inconvenient, and secondly, I often see an error from the cart, saying "the request that you send me is already outdated" (this applies to inline buttons, because they have a lifetime)
Sending messages to the cart occurs through this function :
tlgrm('sendMessage', ['text' => 'Само сообщение']);
Answer the question
In order to leave comments, you need to log in
try {
tlgrm('sendMessage', ['text' => 'Само сообщение']);
} catch (Throwable $t) {
tlgrm('sendMessage', ['text' => $t->getMessage()]);
}
try {
// Code that may throw an Exception or Error.
} catch (Throwable $t) {
// Executed only in PHP 7, will not match in PHP 5.x
} catch (Exception $e) {
// Executed only in PHP 5.x, will not be reached in PHP 7
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question