MR_BaxtiyoR
#41
Bekmurod, POST shaklida bo'lmasachi?
masalan Bunday?


  1. $sql = mysql_query("SELECT `id`, `name`, `text`, `time`, `reads` FROM `cms_news`ORDER BY `time` DESC LIMIT 1");
  2.  
  3. $bot = mysql_fetch_assoc($sql);
  4. Echo '<h2>Nomi: '.$bot['name'].'<br/>ID: '.$bot['id'].'</h2>';
  5.  
  6.  
  7.  
  8. $token = '663039054:AAGAyZvoH8LtKmM2tH21MKapYfge2M_FuRE';
  9. $recipient = '@super11111';
  10. $messege = $bot['name'];
  11.  
  12. file_get_contents("https://api.telegram.org/bot$token/sendMessage?chat_id=$recipient&text=$messege");
Bekmurod
#42
MR_BaxtiyoR, Sinab ko'ring.
  1. $tokeni="12345:jmgakt";
  2. file_get_contents("https://api.telegram.org/bot$tokeni/sendMessage?chat_id=@super11111&text=test");
MR_BaxtiyoR
#43
ishladi
YaxaMedia
#44
  1. <?php
  2.  
  3. // token maydoni
  4. define('bot_token','624400229:AAGieD6uZR_4dVvYD6zD0zmCt7fUTbTJvIM');
  5.  
  6. function xabarYubor(array $content)
  7. {
  8. return endpoint('sendMessage', $content);
  9. }
  10.  
  11. function buildKeyBoard(array $options, $onetime = false, $resize = true, $selective = true)
  12. {
  13. $replyMarkup = [
  14. 'keyboard' => $options,
  15. 'one_time_keyboard' => $onetime,
  16. 'resize_keyboard' => $resize,
  17. 'selective' => $selective,
  18. ];
  19. $encodedMarkup = json_encode($replyMarkup, true);
  20.  
  21. return $encodedMarkup;
  22. }
  23.  
  24. function bot($method,$datas=[]){
  25. $url = "https://api.telegram.org/bot".bot_token."/".$method;
  26.  
  27. function endpoint($api, array $content, $post = true)
  28. {
  29. $url = 'https://api.telegram.org/bot'.bot_token.'/'.$api;
  30. if ($post) {
  31. $reply = sendAPIRequest($url, $content);
  32. } else {
  33. $reply = sendAPIRequest($url, [], false);
  34. }
  35.  
  36. return json_decode($reply, true);
  37. }
  38.  
  39. function sendAPIRequest($url, array $content, $post = true)
  40. {
  41. if (isset($content['chat_id'])) {
  42. $url = $url.'?chat_id='.$content['chat_id'];
  43.  
  44. //$url = $url.'?'.http_build_query($content);
  45.  
  46. unset($content['chat_id']);
  47. //unset($content);
  48. }
  49. $ch = curl_init();
  50. curl_setopt($ch, CURLOPT_URL, $url);
  51. curl_setopt($ch, CURLOPT_HEADER, false);
  52. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  53. if ($post) {
  54. curl_setopt($ch, CURLOPT_POST, 1);
  55. curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
  56. }
  57. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  58. $result = curl_exec($ch);
  59. if ($result === false) {
  60. $result = json_encode(['ok'=>false, 'curl_error_code' => curl_errno($ch), 'curl_error' => curl_error($ch)]);
  61. }
  62. curl_close($ch);
  63.  
  64. return $result;
  65. }
  66.  
  67. function buildForceReply($selective = true)
  68. {
  69. $replyMarkup = [
  70. 'force_reply' => true,
  71. 'selective' => $selective,
  72. ];
  73. $encodedMarkup = json_encode($replyMarkup, true);
  74.  
  75. return $encodedMarkup;
  76. }
  77.  
  78.  
  79. // uzizni ID raqamingizni kiritasiz
  80. $admin = "542680109";
  81.  
  82. // BOT iz username si
  83. $bot_name = "qarawilrobot";
  84. // manba @gayratfayz kanali
  85.  
  86. $efede = json_decode(file_get_contents('php://input'), true);
  87.  
  88. //basic
  89. $text = $efede["message"]["text"];
  90. $photo = $efede["message"]["photo"];
  91. $sana = $efede["message"]["date"];
  92. $chat_id = $efede["message"]["chat"]["id"];
  93.  
  94. // chat
  95. $cfname = $efede["message"]["chat"]["first_name"];
  96. $cid = $efede["message"]["chat"]["id"];
  97. $clast_name = $efede["message"]["chat"]["last_name"];
  98. $turi = $efede["message"]["chat"]["type"];
  99.  
  100. //user info
  101. $ufname = $efede["message"]["from"]["first_name"];
  102. $uname = $efede["message"]["from"]["last_name"];
  103. $ulogin = $efede["message"]["from"]["username"];
  104. $uid = $efede["message"]["from"]["id"];
  105. $user_id = $efede["message"]["from"]["id"];
  106.  
  107. //reply info
  108. $sreply = $efede["message"]["reply_to_message"]["text"];
  109.  
  110.  
  111. // umumiy menu
  112. $menu = [["ℹMen haqimda"],["?Xabar yozish"],["?Bot haqida"]];
  113.  
  114.  
  115.  
  116. if ($text == '/start') {
  117. $keyfd = buildKeyBoard($menu, $onetime = false, $resize = true);
  118. $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "*✋Assalomu alaykum $ufname $uname*", 'parse_mode' => 'markdown'];
  119.  
  120. xabarYubor($content);
  121. }
  122.  
  123. if ($text == 'ℹMen haqimda') {
  124.  
  125. $keyfd = buildKeyBoard($menu, $onetime = false, $resize = true);
  126. $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "*Siz haqingizda!*
  127. _?Ismingiz:_ $ufname
  128. _?Familiyangiz:_ $uname
  129. _?Loginingiz:_ @$ulogin
  130. _?raqamingiz:_ $user_id
  131. _?guruh:_ $uid", 'parse_mode' => 'markdown'];
  132.  
  133. xabarYubor($content);
  134. }
  135.  
  136. if ($text == '?Bot haqida') {
  137.  
  138. $keyfd = buildKeyBoard($menu, $onetime = false, $resize = true);
  139. $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "*Salom $ufname botimiz orqali siz admin bilan bog‘lanishingiz mumkin!*
  140. _Bot_ @gayratfayz _Media Group® tomonidan yaratildi?_", 'parse_mode' => 'markdown'];
  141.  
  142. xabarYubor($content);
  143. }
  144.  
  145. if ($text == '/feedback' || $text == "?Xabar yozish"){
  146. $keyfd = buildForceReply($selective=true);
  147. $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "*Xabar matnini kiriting*", 'parse_mode' => 'markdown'];
  148. xabarYubor($content);
  149. }
  150.  
  151. if ($sreply == 'Xabar matnini kiriting'){
  152.  
  153. $option = $menu;
  154. $keyfd = buildKeyBoard($option, $onetime = false);
  155. $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "*?Xabaringiz bizga yetib keldi?*
  156.  
  157. _?Tez orada javob qaytaramiz✍_", 'parse_mode' => 'markdown'];
  158. xabarYubor($content);
  159.  
  160. $option = [["javob#$chat_id"]];
  161. $keyfd = buildKeyBoard($option, $onetime = false);
  162. $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'];
  163. xabarYubor($content);
  164. }
  165.  
  166. $inreg = explode("#",$text);
  167. $intype = $inreg[0];
  168. $us_id = $inreg[1];
  169.  
  170. if ($intype == 'javob') {
  171.  
  172. $keyfd = buildForceReply($selective=true);
  173. $content = ['chat_id' => $chat_id, 'reply_markup' => $keyfd, 'text' => "javob matnini kiriting#$us_id", 'parse_mode' => 'markdown'];
  174. xabarYubor($content);
  175. }
  176.  
  177. $inreg = explode("#",$sreply);
  178. $intype = $inreg[0];
  179. $us_id = $inreg[1];
  180.  
  181. if ($intype == 'javob matnini kiriting'){
  182.  
  183. $option = $menu;
  184. $keyfd = buildKeyBoard($option, $onetime = false);
  185. $content = ['chat_id' => $us_id, 'reply_markup' => $keyfd, 'text' => $text, 'parse_mode' => 'markdown'];
  186. xabarYubor($content);
  187.  
  188. $option = $menu;
  189. $keyfd = buildKeyBoard($option, $onetime = false);
  190. $content = ['chat_id' => $admin, 'reply_markup' => $keyfd, 'text' => "Xabar yetkazildi", 'parse_mode' => 'markdown'];
  191. xabarYubor($content);
  192. }

3 daqiqa 42 soniyadan keyin yozdi:
tekshirip beringlar
gi8ri7
#45
Kutubxonana imenna qayerdan olsam bo'ladi githubdan bergan likingizda tushunmadim
Biriktirilgan fayllar [1]:
 img_20190124_173153.jpg (149.1 KB) (273 ↴)
Shokha
#46
STRaKER, bazaga ulanish joyi qani???
18
Izbosh
#47
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
gi8ri7
#48
view.php?act=post&id=47485 aloo
gi8ri7
#49
O'sha kutubxona

http://bkstudio.000webhostapp.com/vendor.zip
gi8ri7
#50
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
266
bayotshoh
#51
Bu library Laravel uchun ku boshqalagayam tushuradimi yoki
298
STRaKER
#52
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
ㅤㅤㅤㅤʟᴀᴄᴏsᴛᴇ
#53
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
6666
Nuriddin777
#54
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
#55
Nuriddin777, Namuna bilan joylang, barchasi chiqishi kerak edi
6666
Nuriddin777
#56
MR_BaxtiyoR, http://mp3party.net/music/4790549

Mana shu

Textga ham saqlagan edim fayl biriktirib yuborolmayabman
Biriktirilgan fayllar [2]:
 file_get_contents.txt (13.8 KB) (289 ↴)
 browser.txt (16.22 KB) (268 ↴)
410
uDesign
#57
Nuriddin777, # Nuriddin777 (03.04.2019 / 16:24)
MR_BaxtiyoR, http://mp3party.net/music/4790549

Mana shu

Textga ham saqlagan edim fayl biriktirib yuborolmayabman
agar 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
6666
Nuriddin777
#58
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?
Аьзамхон Иномов
#59
salom saytdagi malumotlarni qanda botga yuboraman qaysi so'rovlar orqali
DjHuSo
#60
btc, # btc (09.01.2020 / 19:41)
salom saytdagi malumotlarni qanda botga yuboraman qaysi so'rovlar orqali
view.php?act=post&id=76825

Kunduzi: °C

7 Feb 2026 yil
Joylashuv aniqlanmadi
CORES.UZ
Платформа разработчиков
который можно найти всё
UZFOR.NET - Rasmiy guruh
t.me/@uzfornet_rasmiy