PHP Telegram bot: How send photo & count users?
<?php $d=json_decode(file_get_contents("php://input")); if(isset($d->msg)) api("sendPic", $d->chat->id, "IMG_URL"); ?>
PHP Telegram bot: How send photo & count users?
<?php $d=json_decode(file_get_contents("php://input")); if(isset($d->msg)) api("sendPic", $d->chat->id, "IMG_URL"); ?>
I have experimented with PHP Telegram bots and found that using the sendPhoto method instead of non-standard calls helps maintain compatibility with Telegram’s API. In my projects, I also separated the logic for image responses into a dedicated function that handles cURL calls. Regarding user count monitoring, I stored chat identifiers in a database to avoid duplications. Each time a new message arrives, the bot checks if the user is already recorded, which makes it easy to track active users over time and manage bot statistics reliably.
hey, for img replies i tried sendPhoto with a proper curl config. i stored chat ids in a simple text file to count unique users which was quick to update. works for me, hope u find it helpful…