Questions tagged [php-telegram-bot]

The telegram Bots are applications that can be used via telegram chat, the interaction is via Messages. The realization of these bots with PHP simplifies the work of a developer.

It is implemented by API and HTTP-based interface has all the methods of bot telegram (https://stackoverflow.com/tags/telegram-bot/info).

A simple way of use is:

define('BOT_TOKEN', '<YOUR-TOKEN>');
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
define('FILE_URL', 'https://api.telegram.org/file/bot'.BOT_TOKEN.'/');

$content = file_get_contents("php://input");
$update = json_decode($content, true);

$message = isset($update['message']) ? $update['message'] : "";
$chatId = isset($message['chat']['id']) ? $message['chat']['id'] : "";
$text = isset($message['text']) ? $message['text'] : "";

header("Content-Type: application/json");
$parameters = array('chat_id' => $chatId, "text" => 'you wrote: '.$text);
$parameters["method"] = "sendMessage";
341 questions
0
votes
1 answer

PHP - Telegram Bot interactive query

I'm trying to query some data from my database. there is three option for searching data from database User id Phone no. E-mail I've created an inline keyboard by choosing a search option from the above list Screenshot of bot chat I'm looking for…
0
votes
0 answers

Curl return TRUE if is there CURLOPT_RETURNTRANSFER, TRUE ? - php

Hi guys I'll explain my code: I have a telegram bot and I have to write many messages quickly in a group and to write a message it is necessary to execute a link (using the Telegram Api). To do this I use Curl: curl_setopt($ch, CURLOPT_URL,…
Borja
  • 3,359
  • 7
  • 33
  • 66
0
votes
1 answer

i have facing problem with editMessageText

Message is sending but the bot is not editing the message, what's wrong here ? here's my code :- if($text ==…
The Beast
  • 3
  • 2
0
votes
0 answers

When users type "/register" bot is inserting "0" instead of their "user id"

When users type /register, then my bot is inserting "0" instead of their user id in phpMyAdmin. This is the code, what's causing this problem? if (strpos($message, "/register") === 0) { $che = mysqli_query($db, "SELECT * FROM users WHERE id =…
Wiker Bem
  • 29
  • 3
0
votes
1 answer

Madeline Proto sendMediaGroup I can't send, I get an error

Good day to all, please help me understand what the problem is! I'm trying to send Album to telegram via Madeline's library Here is my code: $telegram->sendMediaGroup([ 'chat_id' => '-1001396042418', 'media' => …
0
votes
1 answer

[madelineproto][php] Click Keyboard button and get the updated message

im working on a script that subscribe to inline keyboard bot when i click the keyboard button in bot the bot will update the message with another buttons what i done i got the bot message and click on a button what im missing is that when i click…
Tawfeeq
  • 147
  • 1
  • 1
  • 9
0
votes
1 answer

is it possible to send both ReplyKeybaordMarkup and InlineKeyboardmarkup with one message in telegram bot api

currently i have this but it just sent the 'ReplyKeyboardMarkup' ['chat_id' => 'BlaBlaBla', 'text' => 'a', 'reply_markup' => [ 'keyboard' => [[['text' => 'this is reply', 'request_contact' => true ]]] , 'inline_keyboard' => [[['text' =>…
0
votes
1 answer

I can not be accessing to files of 'domains' directory in openserver with ngrok for setting webhook for telegram bot in windows

Before using windows I was Ubuntu User. When I used ngrok on ubuntu, It automatically accesses to /var/www/html directory, afetr this I can easily open php file which telegram bot codes to see result. Now on Windows, I am using openserver.…
Abdurakhmon
  • 63
  • 1
  • 10
0
votes
1 answer

Telegram Bot Keyboard Button

I got problem with Telegram Keyboard , I want to send a string in my array for markup that has a "#" but with "#" it dosent work and I visited a bot that same mine and that's works good and shows '#' in Keyboard Button how can I fix this?? $string =…
Meti
  • 25
  • 6
0
votes
1 answer

How to create inline buttons for telegram bot in php

I want to make a inline buttons like these. The problem is callback values are not working at all. Hope someone can help me.
0
votes
0 answers

telegram bot api pass empty inline_keyboard -> delete keyboard

I'd like to use the methode editMessageReplyMarkup to get rid of my inline_keyboard buttons. I can get rid of them by passing the 'reply_markup' a json encoded keyboard like that: $k = ['inline_keyboard' => [ …
0
votes
1 answer

why my is still hit my endpoint event without triggered

i create new method as webhook in telegram and it has been registered, my method : // https://api.telegram.org/bot[token]/setWebhook?url=https://xxx/main/execute/ // https://telegram.me/TheXXXBot?start=project register function execute(){ //…
kreamik
  • 609
  • 2
  • 11
  • 24
0
votes
0 answers

Why there are 2 different id's for one channel in telegram?

Normally there is a negative id for each channel in telegram, but when you extract one channel's history, there exists a key in the returned json named as from_id. It is a positive number and it's unique. Meanwhile it belongs to the same channel.…
0
votes
1 answer

Want to filter more then 10 million numbers on Telegram

I need a little help. I have more then 10 millions number and i want to filter those contacts on telegram like which number exist on telegram or not. I have search a lot but not get any method which fulfil my needs. I have checked IsphoneRegistered…
0
votes
1 answer

How to auto send messages from a Telegram Group to my server?

My need is to send ALL messages from a telgram Group to my PHP server. I suppose that I have to use a bot and attach it to my Telegram group. My question is : how to set this bot to send all messages that group members post on my PHP server? I…