Closed MadAlexk closed 7 years ago
edit: #536 allows you to disable verification without modifying core files, please use that instead!
I'm guessing this is related to the fact that you're using Windows. Unfortunately I don't have a Windows installation to test this, but either way the library won't work with Windows. It's laid out for *nix type systems.
i am sad. But why?
Php works with it - not a windows :(( i can give ftp for you, do you want to look on it?
I don't think Windows is on the todo list for us.
Most PHP webservers run on some distribution of nux, which is the most stable way of running it. I urge you to look into a nix server for hosting your bot. Alternatively, you can install VirtualBox on your Windows computer and install it there.
There should be enough information around on the internet on how to do that 😊
I disagree on not supporting Windows, there are people who prefer Windows environment over Linux.
@jacklul Ok, I understand what you mean. For me though, my Windows days are pretty much over, so I'll leave this open for others to implement.
production unsafe (?) workaround: https://github.com/jacklul/php-telegram-bot/commit/46baa111cc59fcb623f5d8653bfb883f8fb183b8
Required Information
Expected behaviour
On set UP: https://......AAEtT4Rh2eBTPakzJOo0bkFk3A-6pxaEErk/set.php
PHP Fatal error: Uncaught Error: Call to a member function getBody() on null in C:\inetpub\WWW.....\63AAEtT4Rh2eBTPakzJOo0bkFk3A-6pxaEErk\vendor\longman\telegram-bot\src\Request.php:227 Stack trace:
0 C:\inetpub\WWW.....\63AAEtT4Rh2eBTPakzJOo0bkFk3A-6pxaEErk\vendor\longman\telegram-bot\src\Request.php(316): Longman\TelegramBot\Request::execute('setWebhook', Array)
1 C:\inetpub\WWW.....\63AAEtT4Rh2eBTPakzJOo0bkFk3A-6pxaEErk\vendor\longman\telegram-bot\src\Request.php(814): Longman\TelegramBot\Request::send('setWebhook', Array)
2 C:\inetpub\WWW.....\63AAEtT4Rh2eBTPakzJOo0bkFk3A-6pxaEErk\vendor\longman\telegram-bot\src\Telegram.php(742): Longman\TelegramBot\Request::setWebhook('https://........', 'C:\inetpub\WWW\...')
3 C:\inetpub\WWW.....\63AAEtT4Rh2eBTPakzJOo0bkFk3A-6pxaEErk\set.php(19): Longman\TelegramBot\Telegram->setWebHook('https://........', 'C:\inetpub\WWW\...')
4 {main}
thrown in C:\inetpub\WWW.....\63AAEtT4Rh2eBTPakzJOo0bkFk3A-6pxaEErk\vendor\longman\telegram-bot\src\Request.php on line 227
<?php // Load composer require DIR . '/vendor/autoload.php';
$API_KEY = 'T4Rh2eBTPakzJOo0bkFk3A-6pxaEErk'; $BOT_NAME = '....st1Bot'; $hook_url = 'https://.......63AAEtT4Rh2eBTPakzJOo0bkFk3A-6pxaEErk/hook.php'; $path_certificate = DIR . '/win_webhook_cert.cer'; echo "hook_url:".$hook_url;
try { // Create Telegram API object $telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);
$result = $telegram->setWebHook($hook_url, $path_certificate);
} catch (Longman\TelegramBot\Exception\TelegramException $e) { echo $e; }