-
-
Notifications
You must be signed in to change notification settings - Fork 959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-open: Input is empty! - hook.php #203
Comments
That error is normal if you call If you did and it's still not working, post again here. |
in my hook file require_once 'vendor/autoload.php';
require_once 'config.php';
try {
$telegram = new Longman\TelegramBot\Telegram($bot_token, $bot_name);
$update = $telegram->handle();
file_put_contents('value.txt', $update);
}
catch (Longman\TelegramBot\Exception\TelegramException $e) {
echo $e;
} after send message in telegram client I have empty value.txt, but if unset webhook and use |
That's because Just to verify... put this: file_put_contents('input.txt', file_get_contents("php://input")); before and then send command to the bot, is the 'input.txt' file empty? It shouldn't, if it is it MIGHT be an issue with webhost configuration. |
File input.txt have json with last message. |
Well then, try $input = file_get_contents("php://input");
if (!empty($input)) {
$telegram->setCustomInput($input);
} before |
try {
$telegram = new Longman\TelegramBot\Telegram($bot_token, $bot_name);
$input = file_get_contents("php://input");
if (!empty($input)) {
$telegram->setCustomInput($input);
}
$update = $telegram->handle();
file_put_contents('value.txt', $update);
}
catch (Longman\TelegramBot\Exception\TelegramException $e) {
echo $e;
} value.txt is empty |
Does it throw 'input empty' exception now? $update = $telegram->handle();
file_put_contents('value.txt', $update); as I said before: this will not output the update, it will output the result of handle(), which can be reply from Telegram API to, for example, sendMessage. |
in file value.txt - I have "1" |
You're doing it wrong, I have a feeling you haven't read the readme, it's all there. How to create own commands: |
Can close here? |
Have the same problem with webhooks. Use SSL from Let's Encrypt, webhook is set, but have the error:
exception 'Longman\TelegramBot\Exception\TelegramException' with message 'Input is empty!' in path/vendor/longman/telegram-bot/src/Telegram.php:414 Stack trace: #0 path/index.php(14): Longman\TelegramBot\Telegram->handle() #1 {main}
The text was updated successfully, but these errors were encountered: