Telegram Bot - PHP Webhook POST for file

I have already read several questions about bot API but cannot find a solution.

My bot works fine without setting up webhook and handling / getUpdates. But I can't get it to work by setting " https://www.domain.com/page.php " as a webhook.

I have shared hosting behind a Cloudflare Flexible SSL certificate and the browsers do not warn me about this, so I assume it works fine.

I'm trying to get Telegram POST to a file to get a hint if the webhook needs different parsing, but it's empty and can't see the ssl_acces.log, so I can't even see if Telegram reaches the page ...

Here's a snippet:

$message = json_decode(file_get_contents('php://input'), true);
file_put_contents('telegram.txt', var_dump($message));

      

What am I doing wrong? Thank.

[DECISION]

Recording method:

$debug = file_get_contents('php://input');
$fp = fopen('debug.txt', 'w');
fwrite($fp, $debug);
fclose($fp);

      

And the solution is that the webhook must be installed without wwww: /setwebhook?url=https://domain.com/page.php

+3


source to share


1 answer


I had a similar problem and I fixed deleting the line

 (RewriteCond %{HTTP_USER_AGENT} ^$ [OR]) 

      



from file .htaccess

-2


source







All Articles