MR_BaxtiyoR
#41
Bekmurod, POST shaklida bo'lmasachi?
masalan Bunday?
0
Kod · PHP23 qator
$sql = mysql_query("SELECT `id`, `name`, `text`, `time`, `reads` FROM `cms_news`ORDER BY `time` DESC LIMIT 1");



$bot = mysql_fetch_assoc($sql);

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");
Bekmurod
#42
MR_BaxtiyoR, Sinab ko'ring.
0
Kod · PHP3 qator
$tokeni="12345:jmgakt";

 file_get_contents("https://api.telegram.org/bot$tokeni/sendMessage?chat_id=@super11111&text=test");
MR_BaxtiyoR
#43
ishladi
0
YaxaMedia
#44

3 daqiqa 42 soniyadan keyin yozdi:
tekshirip beringlar
0
Kod · PHP383 qator
<?php 



// token maydoni

define('bot_token','624400229:AAGieD6uZR_4dVvYD6zD0zmCt7fUTbTJvIM');



    function xabarYubor(array $content)

    {

        return endpoint('sendMessage', $content);

    }



    function buildKeyBoard(array $options, $onetime = false, $resize = true, $selective = true)

    {

        $replyMarkup = [

            'keyboard'          => $options,

            'one_time_keyboard' => $onetime,

            'resize_keyboard'   => $resize,

            'selective'         => $selective,

        ];

        $encodedMarkup = json_encode($replyMarkup, true);



        return $encodedMarkup;

    }



function bot($method,$datas=[]){

    $url = "https://api.telegram.org/bot".bot_token."/".$method;



    function endpoint($api, array $content, $post = true)

    {

        $url = 'https://api.telegram.org/bot'.bot_token.'/'.$api;

        if ($post) {

            $reply = sendAPIRequest($url, $content);

        } else {

            $reply = sendAPIRequest($url, [], false);

        }



        return json_decode($reply, true);

    }



    function sendAPIRequest($url, array $content, $post = true)

    {

        if (isset($content['chat_id'])) {

            $url = $url.'?chat_id='.$content['chat_id'];



            //$url = $url.'?'.http_build_query($content);



            unset($content['chat_id']);

            //unset($content);

        }

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);

        curl_setopt($ch, CURLOPT_HEADER, false);

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        if ($post) {

            curl_setopt($ch, CURLOPT_POST, 1);

            curl_setopt($ch, CURLOPT_POSTFIELDS, $content);

        }

        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

        $result = curl_exec($ch);

        if ($result === false) {

            $result = json_encode(['ok'=>false, 'curl_error_code' => curl_errno($ch), 'curl_error' => curl_error($ch)]);

        }

        curl_close($ch);



        return $result;

    }



     function buildForceReply($selective = true)

    {

        $replyMarkup = [

            'force_reply' => true,

            'selective'   => $selective,

        ];

        $encodedMarkup = json_encode($replyMarkup, true);



        return $encodedMarkup;

    }

    



// uzizni ID raqamingizni kiritasiz

$admin = "542680109";



// BOT iz username si

$bot_name = "qarawilrobot";

// manba @gayratfayz kanali



$efede = json_decode(file_get_contents('php://input'), true);



//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);

        }



        $inreg = explode("#",$text);

        $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);

        }



        $inreg = explode("#",$sreply);

        $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);

        }
Серёжа tomonidan tahrirlandi ·
gi8ri7
#45
Kutubxonana imenna qayerdan olsam bo'ladi githubdan bergan likingizda tushunmadim
0
Shokha
#46
STRaKER, bazaga ulanish joyi qani???
0
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
0

#49

#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
0
266
bayotshoh
#51
Bu library Laravel uchun ku boshqalagayam tushuradimi yoki
0
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
0
ㅤㅤㅤㅤʟᴀᴄᴏ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
0
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??
0
MR_BaxtiyoR
#55
Nuriddin777, Namuna bilan joylang, barchasi chiqishi kerak edi
0
6666
Nuriddin777
#56
MR_BaxtiyoR, http://mp3party.net/music/4790549

Mana shu

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