Yangi formatda davom etish uchun: https://uzfor.net/view.php?id=3446&page=3
PHP dasturlash tilida Telegram bot yozish
Mavzu fayllari (5)
Xabarlar
Bekmurod, POST shaklida bo'lmasachi?
masalan Bunday?
masalan Bunday?
$sql = mysql_query("SELECT `id`, `name`, `text`, `time`, `reads` FROM `cms_news`ORDER BY `time` DESC LIMIT 1"); Echo '<h2>Nomi: '.$bot['name'].'<br/>ID: '.$bot['id'].'</h2>'; $token = '663039054:AAGAyZvoH8LtKmM2tH21MKapYfge2M_FuRE'; $recipient = '@super11111'; $messege = $bot['name']; file_get_contents("https://api.telegram.org/bot$token/sendMessage?chat_id=$recipient&text=$messege");
<?php // token maydoni { return endpoint('sendMessage', $content); } { $replyMarkup = [ 'keyboard' => $options, 'one_time_keyboard' => $onetime, 'resize_keyboard' => $resize, 'selective' => $selective, ]; return $encodedMarkup; } function bot($method,$datas=[]){ $url = "https://api.telegram.org/bot".bot_token."/".$method; { $url = 'https://api.telegram.org/bot'.bot_token.'/'.$api; if ($post) { $reply = sendAPIRequest($url, $content); } else { $reply = sendAPIRequest($url, [], false); } } { $url = $url.'?chat_id='.$content['chat_id']; //$url = $url.'?'.http_build_query($content); //unset($content); } if ($post) { } if ($result === false) { $result = json_encode(['ok'=>false, 'curl_error_code' => curl_errno($ch), 'curl_error' => curl_error($ch)]); } return $result; } function buildForceReply($selective = true) { $replyMarkup = [ 'force_reply' => true, 'selective' => $selective, ]; return $encodedMarkup; } // uzizni ID raqamingizni kiritasiz $admin = "542680109"; // BOT iz username si $bot_name = "qarawilrobot"; // manba @gayratfayz kanali //basic $text = $efede["message"]["text"]; $photo = $efede["message"]["photo"]; $sana = $efede["message"]["date"]; $chat_id = $efede["message"]["chat"]["id"]; // chat $cfname = $efede["message"]["chat"]["first_name"]; $cid = $efede["message"]["chat"]["id"]; $clast_name = $efede["message"]["chat"]["last_name"]; $turi = $efede["message"]["chat"]["type"]; //user info $ufname = $efede["message"]["from"]["first_name"]; $uname = $efede["message"]["from"]["last_name"]; $ulogin = $efede["message"]["from"]["username"]; $uid = $efede["message"]["from"]["id"]; $user_id = $efede["message"]["from"]["id"]; //reply info $sreply = $efede["message"]["reply_to_message"]["text"]; // umumiy menu $menu = [["ℹMen haqimda"],["?Xabar yozish"],["?Bot haqida"]]; if ($text == '/start') { $keyfd = buildKeyBoard($menu, $onetime = false, $resize = true); $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "*✋Assalomu alaykum $ufname $uname*", 'parse_mode' => 'markdown']; xabarYubor($content); } if ($text == 'ℹMen haqimda') { $keyfd = buildKeyBoard($menu, $onetime = false, $resize = true); $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "*Siz haqingizda!* _?Ismingiz:_ $ufname _?Familiyangiz:_ $uname _?Loginingiz:_ @$ulogin _?raqamingiz:_ $user_id _?guruh:_ $uid", 'parse_mode' => 'markdown']; xabarYubor($content); } if ($text == '?Bot haqida') { $keyfd = buildKeyBoard($menu, $onetime = false, $resize = true); $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "*Salom $ufname botimiz orqali siz admin bilan bog‘lanishingiz mumkin!* _Bot_ @gayratfayz _Media Group® tomonidan yaratildi?_", 'parse_mode' => 'markdown']; xabarYubor($content); } if ($text == '/feedback' || $text == "?Xabar yozish"){ $keyfd = buildForceReply($selective=true); $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "*Xabar matnini kiriting*", 'parse_mode' => 'markdown']; xabarYubor($content); } if ($sreply == 'Xabar matnini kiriting'){ $option = $menu; $keyfd = buildKeyBoard($option, $onetime = false); $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "*?Xabaringiz bizga yetib keldi?* _?Tez orada javob qaytaramiz✍_", 'parse_mode' => 'markdown']; xabarYubor($content); $option = [["javob#$chat_id"]]; $keyfd = buildKeyBoard($option, $onetime = false); $content = ['chat_id' => $admin, 'reply_markup' => $keyfd, 'text' => "Yangi Xabar \n Kimdan: $ufname $uname \n Login: @$ulogin \n ID: $uid \n\n Matn: $text", 'parse_mode' => 'markdown']; xabarYubor($content); } $intype = $inreg[0]; $us_id = $inreg[1]; if ($intype == 'javob') { $keyfd = buildForceReply($selective=true); $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "javob matnini kiriting#$us_id", 'parse_mode' => 'markdown']; xabarYubor($content); } $intype = $inreg[0]; $us_id = $inreg[1]; if ($intype == 'javob matnini kiriting'){ $option = $menu; $keyfd = buildKeyBoard($option, $onetime = false); $content = ['chat_id' => $us_id, 'reply_markup' => $keyfd, 'text' => $text, 'parse_mode' => 'markdown']; xabarYubor($content); $option = $menu; $keyfd = buildKeyBoard($option, $onetime = false); $content = ['chat_id' => $admin, 'reply_markup' => $keyfd, 'text' => "Xabar yetkazildi", 'parse_mode' => 'markdown']; xabarYubor($content); }
3 daqiqa 42 soniyadan keyin yozdi:
tekshirip beringlar
Kutubxonana imenna qayerdan olsam bo'ladi githubdan bergan likingizda tushunmadim
Biriktirilgan fayllar [1]:
— img_20190124_173153.jpg (149.1 KB) (231 ↴)
— img_20190124_173153.jpg (149.1 KB) (231 ↴)
Salom. Bot tuzamiz (qo'ldan kelsa):
Ishimizdan namuna: @textmagic_bot, @telefonolxbot
Ps:
Saytga telegramda bot yozamiz:
Saytdagi shaxsiy xabarlar bot orqali borishi va javob qaytarish mumkin bo'ladi bot orqali biror userga xabar yozish ham mumkin va mayda funksiyalar mavjud.
Sizning ideyangizni ham qilishimiz mumkin
@morganbek / sh.x
Ishimizdan namuna: @textmagic_bot, @telefonolxbot
Ps:
Saytga telegramda bot yozamiz:
Saytdagi shaxsiy xabarlar bot orqali borishi va javob qaytarish mumkin bo'ladi bot orqali biror userga xabar yozish ham mumkin va mayda funksiyalar mavjud.
Sizning ideyangizni ham qilishimiz mumkin
@morganbek / sh.x
YaxaMedia, # YaxaMedia (23.12.2018 / 19:53)
<?php
// token maydoni
define('bot_token','624400229:AAGieD6uZR_4dVvYD6zD0zmCt7fUTbTJvIM');
function xabarYubor(array $content)
{
return endpoint('sendMessage', $content);
Ishlamadiyoov
<?php
// token maydoni
define('bot_token','624400229:AAGieD6uZR_4dVvYD6zD0zmCt7fUTbTJvIM');
function xabarYubor(array $content)
{
return endpoint('sendMessage', $content);
Ishlamadiyoov
Shokha, bazaga ulanish config.php faylida. Bu kodlar ham esimdan chiqib ketibdi, lekin birganim bu php 5.6 dan tepasida ishlamiydi chunki men mysql_query funksiyalaridan foydalanganman, bular php 7 da olib tashlangan
https://t.me/XokimBuvaBot mana bugun tayor bo‘gan botim baho berila shunchaki qiziqish bu bot funkisiyalari ko‘p guruhlarni 100% nazorat qiladi oddiy tushunarli interfeysi ichiga ogan buyruqlari ko‘p guruhda bemalol gaplashadi xabarlaga javob beradi bu shunchaki qiziqish uchun yaratilgan
PHPda file_get_contents bilan saytdagi malumotlarni html text qilib olganimda malumotlarni yarmi olinmayabdi lekin borwserdan ko'rsa bor shuni boshqa yo'l bilan olib bo'lmaydimi??
MR_BaxtiyoR, http://mp3party.net/music/4790549
Mana shu
Textga ham saqlagan edim fayl biriktirib yuborolmayabman
Mana shu
Textga ham saqlagan edim fayl biriktirib yuborolmayabman
Nuriddin777, # Nuriddin777 (03.04.2019 / 16:24)
MR_BaxtiyoR, http://mp3party.net/music/4790549
Mana shu
Textga ham saqlagan edim fayl biriktirib yuborolmayabmanagar telegramga saytdan olingan hamma ma`lumotni bitada tashiman desangiz bunga yaxshiroq funksiya tuzishingiz kerak sabab telegramga yuboriladigan xabarning maksiman belgigacha ruxsat berilgan yani chegaralangan siz hohlaganizcha ma`lumotni bitada yubora olmisiz 2 3 marta bo`lib yuborsangiz bo`ladi
MR_BaxtiyoR, http://mp3party.net/music/4790549
Mana shu
Textga ham saqlagan edim fayl biriktirib yuborolmayabmanagar telegramga saytdan olingan hamma ma`lumotni bitada tashiman desangiz bunga yaxshiroq funksiya tuzishingiz kerak sabab telegramga yuboriladigan xabarning maksiman belgigacha ruxsat berilgan yani chegaralangan siz hohlaganizcha ma`lumotni bitada yubora olmisiz 2 3 marta bo`lib yuborsangiz bo`ladi
uDesign, Yo'q yubormoqchi emasman ssilkani ajratib olish uchun kerak faqat lekin aynan shu ssilka bor joyi yo'q
100 kun 11 soat 17 daqiqa 28 soniyadan keyin yozdi:
Bot apida 3-4 ta rasmni qanday kanalga bitta message_id ostida yuborsa bo'ladi kim biladi?
100 kun 11 soat 17 daqiqa 28 soniyadan keyin yozdi:
Bot apida 3-4 ta rasmni qanday kanalga bitta message_id ostida yuborsa bo'ladi kim biladi?
btc, # btc (09.01.2020 / 19:41)
salom saytdagi malumotlarni qanda botga yuboraman qaysi so'rovlar orqaliview.php?act=post&id=76825
salom saytdagi malumotlarni qanda botga yuboraman qaysi so'rovlar orqaliview.php?act=post&id=76825
Tavsiya etamiz:
- Hoziroq maydonlarni to'ldiring va reklamangizni joylashtiring!
Mavzuga oid xabarlar soni: 71 ta
So'ngi faollik vaqti: 21:37:47, 16 Sep 2021